1

I am trying to create a PS script in order to retrieve a specific Software Name and then execute the Uninstall String in Silent Mode, No Reboot and SilentlyContinue.

For some reason when I try to execute the command, I receive the error message where the term MSIEXEC.EXE is not recognized. However if I try to execute using CMD line, everything works fine.

Any suggestion what is wrong? Below my script:

$PathUninstall = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall', 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall'
Get-ChildItem $PathUninstall|
    Where-Object{ $_.GetValue('DisplayName') -like '%Software_Name%' } | 
    ForEach-Object{ 
        $uninstallString = $_.GetValue('UninstallString') + '/qn REBOOT=REALLYSUPPRESS'
        Write-Host $uninstallString
        & $uninstallString
    } 
Flavios88
  • 11
  • 2
  • As for why your own solution attempt failed: The call operator, `&`, expects only a _command name/path_ as an argument, not a full _command line_. I hope the linked duplicate solves your problem. – mklement0 Dec 31 '21 at 14:46

0 Answers0