Forum Discussion
Uninstall with system account
I am trying to uninstall a software and it is specified that the
# Set execution policy to bypass
Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process -Force
# Get the uninstall string from the registry
$uninstallString = (Get-ItemProperty "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{1B4AF183-7693-42EC-B7EE-B6B1FB0140F0}_is1").UninstallString
# Start the uninstallation process with administrative privileges
Start-Process -FilePath $uninstallString -ArgumentList "/SILENT" -Wait -Verb RunAs
- Did you also tested this from the device itself when running as system? with the use of psexec -i -s powershell you could open a powershell session in the system context. From there on you could also choice to open the 32 bits version of powershell (sysnative) to find out if maybe the 32 bits issue is giving you issues finding the proper uninstall string
- micheleariisSteel Contributor
oryxway Hi, 2 things:
1-Can you try removing the -Verb RunAs parameter? Since you are running the script as SYSTEM account, you can remove the -Verb RunAs parameter. This should stop the script from asking for credentials.
2-Verify that the $uninstallString variable contains the correct path to the uninstall executable.
- oryxwayIron ContributorThank you, I did that mistake lol removed it and I had to change this to Run script in 64 bit PowerShell Host
Yes- micheleariisSteel Contributor
oryxway And it still doesn't work?
- obold1Copper ContributorRemove `-Verb RunAs` from your script.