Executing Powershell Script

//Executing Powershell Script
Executing Powershell Script 2017-08-17T06:52:37+00:00

The Toolkit Forums General Executing Powershell Script

  • Author
    Posts
  • Max
    Participant
    Post count: 1
    #2234 |

    Hi,
    I have strange problem with executing a Powershell Script from Deploy-Application.ps1.

    These Command should install all Visual C++ Runtimes but I always get errors cause of wrong command or file destination. I think it’s all about quotation marks 🙂
    Maybe somebody can give me a hint how to set the marks in a correct order.

    Execute-Process -FilePath "$env:WinDir\System32\WindowsPowerShell\v1.0\powershell.exe" -Parameters "-File "$DirFiles\Install-VisualCRedistributables.ps1" -Xml "$DirFiles\VisualCRedistributablesAll.xml" -Install" -WindowStyle 'Hidden'

    Thank you in advance!
    BR
    Wiesel

  • Jim
    Participant
    Post count: 43

    What you need to do is escape the quotes in the parameters with the backtick character, under the tilde symbol. Just put a backtick before each of the quotes in the parameters except the beginning and ending quotes. I can never get code to post correctly here, so this probably won’t work, but I’ll give it another try:

    <p>"-File "$DirFiles\Install-VisualCRedistributables.ps1" -Xml "$DirFiles\VisualCRedistributablesAll.xml" -Install" </p>

  • Jim
    Participant
    Post count: 43

    How did you post that code? I’ve tried several things and I can’t get it to work. 🙁

  • Jim
    Participant
    Post count: 43

    Ok, I think I figured out how to post code… One more try. 🙂

    Execute-Process -FilePath "$env:WinDir\System32\WindowsPowerShell\v1.0\powershell.exe" -Parameters "-File <code>"$DirFiles\Install-VisualCRedistributables.ps1” -Xml "$DirFiles\VisualCRedistributablesAll.xml” -Install” -WindowStyle ‘Hidden’

    Why don’t you just put the code from the Install-VisualCRedistributables.ps1 script directly in the Deploy-Application script?

    Edit: It remove the backticks… 🙁 Well at least I’m getting closer… 🙂

You must be logged in to reply to this topic.