I want to run a vbscript from a powereshell. I used cscript.exe and location of vbs. Manually I can get it to work, but through SCCM it does not work. The script basically uninstalls the old version. So manually I see the powershell executes fine by uninstalling but when I try through SCCM nothing happens, it passes through without uninstalling .

$command =" $Path\Uninstall.vbs"

$install = Start-process "CScript.exe" -ArgumentList $Command -Wait -Passthru -Windowstyle hidden

0 Comments   [ + ] Show Comments


Please log in to comment


You're doing it wrong.

Try this
& cscript.exe "$Path\Uninstall.vbs"

If you need the exit code, then you can try this use this

& cscript.exe " $Path\Uninstall.vbs"

Come to think of this, why don't you just do this in PowerShell??

*I think this might be the issue with your command, if your $Path has spaces, you need to wrap this in quotes or cscript wont eat it correctly. You can use the backtick to escape quotes.

$command ="`"$Path\Uninstall.vbs`""
Answered 08/27/2016 by: rileyz
Red Belt

  • Thank you ... This did not work either..
Please log in to comment
Answer this question or Comment on this question for clarity