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" )
    {
        LogMsg "Stopping AdAppMgrSvc service"
        Try { $SVC | Stop-Service -Force }
        Catch { LogMsg $_.Exception.Message }
    }

    LogMsg "Stopping processes"
    Try
    {
        Get-Process | Where { $_.Name -like "AdAppMgr" } | Stop-Process -Force
        Get-Process | Where { $_.Name -like "AutodeskDesktopApp" } | Stop-Process -Force
    }
    Catch { LogMsg $_.Exception.Message }

    LogMsg "Uninstalling Autodesk Desktop App"
    Try { Start-Process -FilePath $PATH -ArgumentList '--mode unattended' -Wait }
    Catch { LogMsg $_.Exception.Message }

    If ( Test-Path "HKLM:\SOFTWARE\Wow6432Node\Autodesk\Autodesk Application Manager" ) {
        LogMsg "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" ) {
        LogMsg "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" ) {
        LogMsg "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" ) {
        LogMsg "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 { LogMsg "Autodesk Desktop App is not installed" }