I am trying to uninstall a software package, eset, in powershell by passing the product identifying number using a variable. The script works when using the productID, but not when using a variable holding the product ID.
$product = Get-WmiObject -Class Win32_Product | Where-Object Name -EQ "ESET Endpoint Antivirus" Write-Host "Product found:$product"
$productID = $product.IdentifyingNumber Write-Host "Product Identifying Number:$productID"
The following code does not work: Start-Process MSIEXEC '/qn /x "$productID" PASSWORD="password" REBOOT="ReallySuppress"'
The following code will work: Start-Process MSIEXEC '/qn /x "{915B4D63-9489-4550-88E8-384CC134A747}" PASSWORD="password" REBOOT="ReallySuppress"'
Error: This installation package could not be opened. Verify that the package exists and that you can access it, or contact the application vendor to verify that this is a valid Windows Installer package.
Any help appreciated.
Thanks!
Tried using a variable and tried using the real value. Expected both ways to work, only using the real value without a variable in place worked.