Previously, I've set the location prior to script execution with the "Set-Location" cmdlet. I've since moved the set-location to line 13.
The script processes, but still $uninst variable is not performing as if I run "Silverlight.Configuration.exe -uninstallApp *sloobapp*" straight at the command line.
Now I believe this is happening because on line 11 i'm setting "$uninst = ($aps.UninstallString)" which is the registry uninstall string pulled from the key above. I'm attempting to run it in this variable.
(pre){{###Sets variable for reg HKCU query, filters for SLOOBAPP, displays displayname, uninstallstring properties
$apsInst = Get-ChildItem -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall|
Get-ItemProperty|Where-Object {$_.DisplayName -match "SLOOBAPP"}
Select-Object -Property DisplayName, UninstallString
ForEach ($aps in $apsInst) {
If ($aps.UninstallString) {
$uninst = $aps.UninstallString
Set-Location -Path "c:\Program Files (x86)\Microsoft Silverlight\5.1.30514.0"
Start-Process -FilePath cmd.exe -ArgumentList '/c', $uninst -wait
}
}} (/pre)