Forums on Intune, SCCM, and Windows 11

Welcome to the forums. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your topics and posts, as well as connect with other members through your own private inbox!

PENDING AlwaysOn UserTunnel To Remove

moulouy

Member
Messages
14
Reaction score
0
Points
1
Hello,
I created a package to remove the Microsoft alwaysOn Usertunnel as user with this script :but can't uninstall the usertunnel
$scriptPath = "$env:ProgramData\RemoveAOVPNUserTunnel.ps1"
$scriptContent = @'
$UserTunnelName = "UserTunnel"
$vpnInstance = Get-CimInstance -Namespace "root\cimv2\mdm\dmmap" -ClassName "MDM_VPNv2_01" |
Where-Object { $_.InstanceID -eq $UserTunnelName }
if ($vpnInstance) {
$vpnInstance | Remove-CimInstance
}
'@
$scriptContent | Set-Content -Path $scriptPath -Encoding UTF8
schtasks /Create /TN "RemoveAOVPNUserTunnel" /TR "powershell.exe -ExecutionPolicy Bypass -File `"$scriptPath`"" /SC ONCE /ST 00:00 /RL HIGHEST /RU "INTERACTIVE" /F
schtasks /Run /TN "RemoveAOVPNUserTunnel"
 

Forum statistics

Threads
7,188
Messages
28,061
Members
18,333
Latest member
Sreeja
Back
Top