#----------------------------------------------------------[Declarations]---------------------------------------------------------- #Script Version $sScriptVersion = "1.0" #script root $PSScriptRoot = ($MyInvocation.MyCommand.Path | Split-Path | Resolve-Path).ProviderPath #logging variables. $logdir = "$($env:ALLUSERSPROFILE)\InstallLogs" $Logfile = "$($logdir)\remove_anyconnect_$(get-date -format `"yyyyMMdd_hhmmsstt`").log" Function LogWrite($string, $color) { if ($Color -eq $null) {$color = "white"} write-host $string -foregroundcolor $color $string | out-file -Filepath $logfile -append } if(!(Test-Path -Path $logdir )){ New-Item -ItemType directory -Path $logdir } ######################################## $CP_USER_NAME = (Get-WmiObject Win32_ComputerSystem | Select-Object -ExpandProperty UserName).Split('\')[1] $user = New-Object System.Security.Principal.NTAccount("corp", "$CP_USER_NAME") $sid = $user.Translate([System.Security.Principal.SecurityIdentifier]) $userprofile = Get-WmiObject -Namespace root/cimv2 -Class win32_userprofile -Filter "SID='$($sid.value)'" $CP_USER_HOME = $userprofile.localpath function stopservices(){ get-service 'ciscod.exe', 'acwebsecagent' | ? { $_.Status -eq 'Started' } | % { $_ | stop-service sleep 1 $result = if (($_ | get-service).Status -eq "Running") {"success"} else {"failure"} LogWrite "Service stopped $result" } } Function acuninstall() { $uninstallerfile = "$PSScriptRoot\Uninstall.exe" $UninstallSyntax = "-remove -silent" $process = Start-Process $uninstallerfile -ArgumentList $UninstallSyntax -Wait -Passthru if ($process.ExitCode -eq 0) { LogWrite "AnyConnect has been successfully uninstalled" yellow } else { LogWrite "installer exit code $($process.ExitCode) for AnyConnect" red } } Function dartuninstall() { $dart = Get-WmiObject -Namespace "root\cimv2\sms" -Class SMS_InstalledSoftware | where { $_.ARPDisplayName -match "Cisco AnyConnect Diagnostics" } $uninst = $dart.UninstallString -Replace "msiexec.exe","" -Replace "/I","" -Replace "/X","" $dartuninstallcode = $uninst.Trim() Start-Process "msiexec.exe" -arg "/X $dartuninstallcode /passive /norestart" -Wait } function startbeforeloginuninstall() { $startbeforelogin = Get-WmiObject -NameSpace "root\cimv2\sms" -class SMS_InstalledSoftware | where { $_.ARPDisplayName -match "Cisco AnyConnect Start Before Login Module"} $startbeforeloginuninst = $startbeforelogin.UninstallString -Replace "msiexec.exe", "" -Replace "/I", "" -Replace "/X", "" $startbeforeloginuninstcode = $startbeforeloginuninst.Trim() Start-Process "msiexec.exe" -arg "/X $startbeforeloginuninstcode /passive /norestart" -Wait } function websecurityuninstall() { $websecuritylogin = Get-WmiObject -NameSpace "root\cimv2\sms" -class SMS_InstalledSoftware | where { $_.ARPDisplayName -match "Cisco AnyConnect Web Security Module" } $websecurityuninst = $websecuritylogin.UninstallString -Replace "msiexec.exe", "" -Replace "/I", "" -Replace "/X", "" $websecurityuninstcode = $websecurityuninst.Trim() Start-Process "msiexec.exe" -arg "/X $websecurityuninstcode /passive /norestart" -Wait } function postureuninstall() { $posturelogin = Get-WmiObject -NameSpace "root\cimv2\sms" -class SMS_InstalledSoftware | where { $_.ARPDisplayName -match "Cisco AnyConnect Posture Module" } $postureuninst = $posturelogin.UninstallString -Replace "msiexec.exe", "" -Replace "/I", "" -Replace "/X", "" $postureuninstcode = $postureuninst.Trim() Start-Process "msiexec.exe" -arg "/X $postureuninstcode /passive /norestart" -Wait } function telemetryuninstall() { $telemetrylogin = Get-WmiObject -NameSpace "root\cimv2\sms" -class SMS_InstalledSoftware | where { $_.ARPDisplayName -match "Cisco AnyConnect Telemetry Module" } $telemetryuninst = $telemetrylogin.UninstallString -Replace "msiexec.exe", "" -Replace "/I", "" -Replace "/X", "" $telemetryuninstcode = $telemetryuninst.Trim() Start-Process "msiexec.exe" -arg "/X $telemetryuninstcode /passive /norestart" -Wait } function namuninstall() { $namlogin = Get-WmiObject -NameSpace "root\cimv2\sms" -class SMS_InstalledSoftware | where { $_.ARPDisplayName -match "Cisco AnyConnect Network Access Manager" } $namuninst = $namlogin.UninstallString -Replace "msiexec.exe", "" -Replace "/I", "" -Replace "/X", "" $namuninstcode = $namuninst.Trim() Start-Process "msiexec.exe" -arg "/X $namuninstcode /passive /norestart" -Wait } function anyconnectuninstall() { $anyconnectlogin = Get-WmiObject -NameSpace "root\cimv2\sms" -class SMS_InstalledSoftware | where { $_.ARPDisplayName -match "Cisco AnyConnect Secure Mobility Client" } $anyconnectuninst = $anyconnectlogin.SoftwareCode $anyconnectuninstcode = $anyconnectuninst.Trim() Start-Process "msiexec.exe" -arg "/X $anyconnectuninstcode /passive /norestart" -Wait }
Wednesday, 7 December 2016
Powershell functions to uninstall anyconnect modules
Keynote KITE error: "Unable to load instrumentation headers"
I checked this issue and was unable to fix it using the KB: https://community.dynatrace.com/community/pages/viewpage.action?pageId=203427725 .
I was able to fix this by:copying the contents of
C:\Users\username\AppData\Roaming\Keynote\Recorder\Builds\KITE8\Source\Application Data\Keynote\Recorder\Config
to the folder:
C:\Users\username\AppData\Roaming\Keynote\Recorder\Config
I was able to fix this by:copying the contents of
C:\Users\username\AppData\Roaming\Keynote\Recorder\Builds\KITE8\Source\Application Data\Keynote\Recorder\Config
to the folder:
C:\Users\username\AppData\Roaming\Keynote\Recorder\Config
Subscribe to:
Posts (Atom)
Detect autopilot session
Ensuring that some apps only install during autopilot is not easily accomplished, you can use the below powershell script as a requiremen...
-
Ensuring that some apps only install during autopilot is not easily accomplished, you can use the below powershell script as a requiremen...
-
Someone got this issue while trying to run a scottrade.com applet. To fix this 1: open java webstart by typing javaws -viewer,in a c...
-
So i was recently tasked with removing wireless restrictions from a VP's windows 7 laptop that some infrastructure company had plac...