Files
management-scripts/Uninstall-AutodeskDesktopApp.ps1
T

26 lines
1.1 KiB
PowerShell
Raw Normal View History

2020-09-07 12:47:36 -04:00
If ( Test-Path "${Env:ProgramFiles(x86)}\Autodesk\Autodesk Desktop App\removeAdAppMgr.exe" ) { $PATH = "${Env:ProgramFiles(x86)}\Autodesk\Autodesk Desktop App\removeAdAppMgr.exe" }
ElseIf ( Test-Path "${Env:ProgramFiles}\Autodesk\Autodesk Desktop App\removeAdAppMgr.exe" ) { $PATH = "${Env:ProgramFiles}\Autodesk\Autodesk Desktop App\removeAdAppMgr.exe" }
If ( $PATH )
{
$SVC = Get-Service -Name "AdAppMgrSvc"
If ( $SVC.Status -ne "Stopped" )
{
Write-Output "Stopping AdAppMgrSvc service"
Try { $SVC | Stop-Service -Force }
Catch { Write-Output $_.Exception.Message }
}
Write-Output "Stopping processes"
Try
{
Get-Process | Where { $_.Name -like "AdAppMgr" } | Stop-Process -Force
Get-Process | Where { $_.Name -like "AutodeskDesktopApp" } | Stop-Process -Force
}
Catch { Write-Output $_.Exception.Message }
Write-Output "Uninstalling Autodesk Desktop App"
Try { Start-Process -FilePath $PATH -ArgumentList '--mode unattended' -Wait }
Catch { Write-Output $_.Exception.Message }
}
Else { Write-Output "Autodesk Desktop App is not installed" }