Files
management-scripts/Uninstall-AutodeskDesktopApp.ps1

43 lines
2.5 KiB
PowerShell

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-Object { $_.Name -like "AdAppMgr" } | Stop-Process -Force
Get-Process | Where-Object { $_.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 }
If ( Test-Path "HKLM:\SOFTWARE\Wow6432Node\Autodesk\Autodesk Application Manager" ) {
Write-Output "Removing: ""HKLM:\SOFTWARE\Wow6432Node\Autodesk\Autodesk Application Manager"""
Remove-Item "HKLM:\SOFTWARE\Wow6432Node\Autodesk\Autodesk Application Manager" -Force -ErrorAction SilentlyContinue
}
If ( Test-Path "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Autodesk Desktop App" ) {
Write-Output "Removing: ""HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Autodesk Desktop App"""
Remove-Item "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Autodesk Desktop App" -Force -ErrorAction SilentlyContinue
}
If ( Test-Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\AdAppMgrSvc.exe" ) {
Write-Output "Removing: ""HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\AdAppMgrSvc.exe"""
Remove-Item "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\AdAppMgrSvc.exe" -Force -ErrorAction SilentlyContinue
}
If ( Test-Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\AutodeskDesktopApp.exe" ) {
Write-Output "Removing: ""HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\AutodeskDesktopApp.exe"""
Remove-Item "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\AutodeskDesktopApp.exe" -Force -ErrorAction SilentlyContinue
}
}
Else { Write-Output "Autodesk Desktop App is not installed" }