aovpn icon indicating copy to clipboard operation
aovpn copied to clipboard

Remove-AlwaysOnVpn doesn’t work in windows 11

Open stcbus opened this issue 3 years ago • 15 comments

The CimInstance commands give an unspecified error.

stcbus avatar Oct 26 '21 18:10 stcbus

What version of Windows are you using?

richardhicks avatar Oct 26 '21 18:10 richardhicks

Looks like Build B21H1 or 10.0.22000

Also can't run "Get-WmiObject -Namespace root\cimv2\mdm\dmmap -Class MDM_VPNv2_01"

On Tue, Oct 26, 2021 at 2:52 PM Richard M. Hicks @.***> wrote:

What version of Windows are you using?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/richardhicks/aovpn/issues/12#issuecomment-952218585, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA5AKKVLTVRAW53BPXTEZ7DUI32HTANCNFSM5GYQIKCQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

stcbus avatar Oct 26 '21 19:10 stcbus

Thanks. I'm able to reproduce. Something must have changed in Windows 11. I'll investigate and see what I can find. Stay tuned.

richardhicks avatar Oct 26 '21 19:10 richardhicks

Appreciate the quick response and you looking into it!

stcbus avatar Oct 26 '21 19:10 stcbus

Quick update on this. It appears to be a bug in Windows 11. I'm still investigating, but for now, it doesn't look like an issue with my code. I'll post more information as I get it.

Thanks!

richardhicks avatar Dec 03 '21 20:12 richardhicks

Have you heard anything new or have any workarounds? It is sort of holding up a Windows 11 deployment.

stcbus avatar Jan 31 '22 16:01 stcbus

I have not. I have numerous customers that have open support cases with Microsoft. I know it is being looked at presently, but I don't know when a fix will be available, unfortunately. :/

richardhicks avatar Feb 01 '22 18:02 richardhicks

Dear Richard, working together with Microsoft friends in Switzerland. I've got the same problem on Windows 10 machines. I queried by SCCM about 22000 of our Windows v19042 desktops. Just 9 of them have the VPN instances filled up! It's frustrating because we're looking for a profile replacement method and I like to remove by WMI followed by an WMI XML import. The PowerShell method seams not to clean up ideally - says the WMI XML import routine. And yes, I also cleaned up any artifacts ;-) We check via SYSTEM account and compared it by WMI Explorer 2 - no way to find something. What can we do? What fills the instances on our nine windows desktops? Do you have any news about this topic?

MadHeimberg avatar May 17 '22 10:05 MadHeimberg

For now I use a very ugly hack to continue to manage the profiles. Basically, I added some logic to the code that if it’s windows 11 and it’s connected I change the DNS suffix for the active network adapter to the suffix I configured Always On to look for (so it’ll disconnect) then just use remove-connection, which still works (as long as always on is disconnected which is why I charge the suffix). Then I clear the suffix so it goes back to what it’s assigned via dhcp. Very messy but we needed something.

On Tue, May 17, 2022 at 6:46 AM MadHeimberg @.***> wrote:

Dear Richard, working together with Microsoft friends in Switzerland. I've got the same problem on Windows 10 machines. I queried by SCCM about 22000 of our Windows v19042 desktops. Just 9 of them have the VPN instances filled up! It's frustrating because we're looking for a profile replacement method and I like to remove by WMI followed by an WMI XML import. The PowerShell method seams not to clean up ideally - says the WMI XML import routine. And yes, I also cleaned up any artifacts ;-) We check via SYSTEM account and compared it by WMI Explorer 2 - no way to find something. What can we do? What fills the instances on our nine windows desktops? Do you have any news about this topic?

— Reply to this email directly, view it on GitHub https://github.com/richardhicks/aovpn/issues/12#issuecomment-1128715794, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA5AKKSON5LSN43G2W6CQMLVKN2IHANCNFSM5GYQIKCQ . You are receiving this because you authored the thread.Message ID: @.***>

stcbus avatar May 17 '22 11:05 stcbus

@MadHeimberg I'm hearing reports that the issue affects some Windows 10 versions as well. Microsoft is aware of the issue and is addressing it as we speak. I'm hearing that an update will be available for this later this summer.

@stcbus Clever! If it works, great! :)

richardhicks avatar May 17 '22 16:05 richardhicks

Dear Richard, do you have any news about this fix? In particular for Windows 10, we now have several scenarios where the profile reset fails. I always try to delete the profile first via WMI in the script (because of the disconnect). Only when this fails, I try with max. 5 attempts via PowerShell. Either way we come to the situation where then the profile with the same name can not be created again because "things" are already there (says WMI). So it appears that it doesn't matter which delete method is chosen. Likewise, I took your advice and added the artifacts/ERM/NetworkList cleanup into the script. It helps to some extent. The WMI create instance Error still appears when creating the previously deleted VPN profile with the same name again. I suspect it is due to "left behind" routes that are preventing the deletion. I had read a corresponding blog by Mr.T-bone (https://www.tbone.se/2022/01/28/windows-11-and-always-on-vpn-problems-soon-to-be-solved/). A fix for this would be really useful. Also that the AllUserConnections can be handled decently in PowerShell (disconnect etc.) The budget in Redmond always seems to be getting a bit smaller 😉

MadHeimberg avatar Jun 14 '22 14:06 MadHeimberg

The latest information I received is that Microsoft has resolved this error but won't be releasing an update until September at the earliest. I'll be sure to update here when the fix is available.

richardhicks avatar Jun 14 '22 15:06 richardhicks

Hi Richard, any news or update on if the update is still on for September?

SteveChecketts avatar Jul 29 '22 10:07 SteveChecketts

The latest information I have is late September. The release date has slipped a few times, so it could still be delayed. Fingers crossed!

richardhicks avatar Aug 01 '22 15:08 richardhicks

FYI, I just tested a preview release of the fix, and it seems to work. I'll post here again as soon as the release is made public.

richardhicks avatar Aug 01 '22 23:08 richardhicks

Any idea if the fix has been made public yet? We seem to see a different error with Novembers updates in Windows 11, instead of 'unspecified error' we see ``` An error occurred while enumerating through a collection: A general error occurred that is not covered by a more specific error code..

![image](https://user-images.githubusercontent.com/37147695/205300438-ff13b16f-8226-4df2-9756-54005e87fd43.png)

Stuart42 avatar Dec 02 '22 13:12 Stuart42

Unfortunately, Microsoft has pushed this update back once again. The target release date is now February 2023. :/

richardhicks avatar Dec 02 '22 16:12 richardhicks

@richardhicks Do you know if we're still on track for February Patch Tuesday?

FingerlessGlov3s avatar Jan 30 '23 14:01 FingerlessGlov3s

The last I heard, that's the plan. Fingers crossed!

richardhicks avatar Jan 30 '23 15:01 richardhicks

The issue still exists after installing the February patches. Do you have a Microsoft reference for the case, or the private hotfix KB number? I've raised a support request and they don't appear able to find any information internally.

torque1 avatar Feb 21 '23 14:02 torque1

I was really hoping this would be fixed, as we fear it's going to cause us some issues if we need to redeploy the VPN profile for any reason, such as adding a new route.

I doubt there is a reference 😢, only thing you could do it log a ticket with Microsoft Support and see where it leads. @richardhicks is that what you did originally?

FingerlessGlov3s avatar Feb 21 '23 16:02 FingerlessGlov3s

Man what a ridiculous amount of time for a stupid bug. MS really seems incompetent.

In any case, we worked around it for now by just using the rasdial disconnect command a few times, such as:

rasdial $AOVPNProfile.Name /DISCONNECT Start-Sleep -Seconds 2 rasdial $AOVPNProfile.Name /DISCONNECT Start-Sleep -Seconds 2 rasdial $AOVPNProfile.Name /DISCONNECT Start-Sleep -Seconds 2 rasdial $AOVPNProfile.Name /DISCONNECT Start-Sleep -Seconds 2

remove-VpnConnection -AllUserConnection $AOVPNProfile.Name -Force

On Tue, Feb 21, 2023 at 11:28 AM FingerlessGloves @.***> wrote:

I was really hoping this would be fixed, as we fear it's going to cause us some issues if we need to redeploy the VPN profile for any reason, such as adding a new route.

I doubt there is a reference 😢, only thing you could do it log a ticket with Microsoft Support and see where it leads. @richardhicks https://github.com/richardhicks is that what you did originally?

— Reply to this email directly, view it on GitHub https://github.com/richardhicks/aovpn/issues/12#issuecomment-1438769905, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA5AKKUPUFWTJJJLSDICQSTWYTUL3ANCNFSM5GYQIKCQ . You are receiving this because you were mentioned.Message ID: @.***>

stcbus avatar Feb 21 '23 16:02 stcbus

We're deploying the user VPN, which isn't a device wide VPN, so the -AllUserConnection sadly won't work for me 😢.

FingerlessGlov3s avatar Feb 21 '23 16:02 FingerlessGlov3s

You should be able to run it under the user context, then and remove the -alluserconnection flag, right?

On Tue, Feb 21, 2023 at 11:34 AM FingerlessGloves @.***> wrote:

We're deploying the user VPN, which isn't a device wide VPN, so the -AllUserConnection sadly won't work for me 😢.

— Reply to this email directly, view it on GitHub https://github.com/richardhicks/aovpn/issues/12#issuecomment-1438777895, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA5AKKUZZGD5DPWO2CURLILWYTVBTANCNFSM5GYQIKCQ . You are receiving this because you were mentioned.Message ID: @.***>

stcbus avatar Feb 21 '23 17:02 stcbus

You should be able to run it under the user context, then and remove the -alluserconnection flag, right?

Our install requires SYSTEM context to install the VPN profile in to the logged in users WMI, for one offs we can do that command without the argument but for mass deployment, it's not really do-able.

FingerlessGlov3s avatar Feb 21 '23 17:02 FingerlessGlov3s

I'm looking into this now. I'll let you know as soon as I know more.

richardhicks avatar Feb 27 '23 18:02 richardhicks

I was really hoping this would be fixed, as we fear it's going to cause us some issues if we need to redeploy the VPN profile for any reason, such as adding a new route.

I doubt there is a reference 😢, only thing you could do it log a ticket with Microsoft Support and see where it leads. @richardhicks is that what you did originally?

One of my software partners has an open support case. I'm checking now on the status. I'll post something here as soon as I know more.

FYI, you can always update routes using Add-VpnConnectionRoute without having to redeploy the entire profile. :)

richardhicks avatar Feb 27 '23 18:02 richardhicks

Man what a ridiculous amount of time for a stupid bug. MS really seems incompetent. In any case, we worked around it for now by just using the rasdial disconnect command a few times, such as: rasdial $AOVPNProfile.Name /DISCONNECT Start-Sleep -Seconds 2 rasdial $AOVPNProfile.Name /DISCONNECT Start-Sleep -Seconds 2 rasdial $AOVPNProfile.Name /DISCONNECT Start-Sleep -Seconds 2 rasdial $AOVPNProfile.Name /DISCONNECT Start-Sleep -Seconds 2 remove-VpnConnection -AllUserConnection $AOVPNProfile.Name -Force On Tue, Feb 21, 2023 at 11:28 AM FingerlessGloves @.> wrote: I was really hoping this would be fixed, as we fear it's going to cause us some issues if we need to redeploy the VPN profile for any reason, such as adding a new route. I doubt there is a reference 😢, only thing you could do it log a ticket with Microsoft Support and see where it leads. @richardhicks https://github.com/richardhicks is that what you did originally? — Reply to this email directly, view it on GitHub <#12 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA5AKKUPUFWTJJJLSDICQSTWYTUL3ANCNFSM5GYQIKCQ . You are receiving this because you were mentioned.Message ID: @.>

Sadly, they actually fixed this last year. I've tested the private hotfix. I'm not sure what the hold-up is with the general release. Terribly frustrating, for sure.

richardhicks avatar Feb 27 '23 18:02 richardhicks

Hey everyone. I spoke with Microsoft today, and they indicated this fix was released on February 21, but only for Windows 11 21H2. It was not made available for Windows 11 22H2, unfortunately. I'll do some testing ASAP and confirm operation before closing this issue.

richardhicks avatar Feb 27 '23 20:02 richardhicks

Hey everyone. I spoke with Microsoft today, and they indicated this fix was released on February 21, but only for Windows 11 21H2. It was not made available for Windows 11 22H2, unfortunately. I'll do some testing ASAP and confirm operation before closing this issue.

Did they indicate if any fix is forthcoming for 22H2?

torque1 avatar Feb 28 '23 08:02 torque1