Looping an uninstall per user

Comments

2 comments

  • Luke Nichols

    Mike,

    Try this:

    #Define your value of "USERAPP" here
    $userApp = "USERAPP"

    #Get a list of all user profiles on the system
    $path = 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\*'
    $profileList = Get-ItemProperty -Path $path | Select-Object -Property PSChildName, ProfileImagePath

    #Run the command through all user profiles
    foreach ($profile in $profileList) {
         if (Test-Path $($profile.ProfileImagePath)\AppData\Local\$userApp\Update.exe) {
              Invoke-Command "$($profile.ProfileImagePath)\AppData\Local\$userApp\Update.exe --uninstall -s"
         }
    }

    #Close script with error code 0, indicating success
    exit 0

    1
    Comment actions Permalink
  • Wahorn

    I'm having this same issue with the same vendor's product it sounds like. Was this ever confirmed to work? Was this run as PowerShell?

    0
    Comment actions Permalink

Please sign in to leave a comment.