I'm working on a script to remove all versions of SAP GUI here is what I have
$uninstall=Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Where-Object displayname -like "*SAP*" | select uninstallstring
foreach ($app in $uninstall)
{
Start-Process "$uninstall" -verb runas -Wait
}
Start-Process : This command cannot be run due to the error: The system cannot find the file specified.
At line:5 char:9
+ Start-Process "$uninstall" -verb runas -Wait
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Start-Process], InvalidOperationException
+ FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand
Start-Process : This command cannot be run due to the error: The system cannot find the file specified.
At line:5 char:9
+ Start-Process "$uninstall" -verb runas -Wait
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Start-Process], InvalidOperationException
+ FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand