Execute-Process -path "cscript.exe" error

//Execute-Process -path "cscript.exe" error
Execute-Process -path "cscript.exe" error2016-06-08T01:26:31+00:00

The Toolkit Forums General Execute-Process -path "cscript.exe" error

  • Author
  • Tyson
    Post count: 1

    I cannot figure this out for the life of me. Whenever I’m trying to launch a .vbs script, i’m getting the following error –

    Here is the code if it formats it correctly and version –

    [version]$deployAppScriptVersion = [version]’3.6.8′

    ForEach ($officeExecutable in $officeExecutables) {
    If (Test-Path -Path (Join-Path -Path $dirOfficeC2R -ChildPath “root\Office15\$officeExecutable”) -PathType Leaf) {
    Write-Log -Message ‘Microsoft Office 2013 C2R was detected. Will be uninstalled.’ -Source $deployAppScriptFriendlyName
    Execute-Process -Path “cscript.exe” -Parameters “”$dirSupportFiles\OffScrub_O15c2r.vbs” ALL /S /Q /NoCancel /Bypass 1″ -WindowStyle Hidden -IgnoreExitCodes ‘1,2,3,42,34,67’

    Any help would be great!

  • Kevin
    Post count: 7

    <pre class=”brush: powershell; gutter: true; first-line: 1; highlight: []; html-script: false”>I'm gonna guess doublequotes in doublequotes is the problem.
    I think this will work in your case:

    Execute-Process -Path “cscript.exe” -Parameters “”$dirSupportFiles\OffScrub_O15c2r.vbs” ALL /S /Q /NoCancel /Bypass 1″ -WindowStyle Hidden -IgnoreExitCodes ‘1,2,3,42,34,67’

    Notice the two ` I added. Those make powershell interpret the quotes as text, and not as the start or stop of something that should quoted as text.
    My explanation could be better, but I've made similar deployments where this works.

    edit: Damn formatting

  • Kevin
    Post count: 7

    Ok, I’m not allowed to edit my previous answer. To clarify, I added ` in front both of the ” that encase the path of the vbs-file.

  • Pierrick
    Post count: 15

    Kevin is right,

    Thanks to your screenshot, I see you’re using the smart quotes ”” (in HTLM code).
    This is a typical issue which can be an huge loss of times !

    Be careful when you copy/paste from the Web and replace them with ASCII quotes.

    Refer to this article: http://windowsitpro.com/powershell/powershell-got-smart-about-smart-quotes

You must be logged in to reply to this topic.