Powershell Help

MishraMishra Member Posts: 2,468 ■■■■□□□□□□
Alright, this is driving me insane. Can you guys help?

Purpose: Writing a script to create Citrix icons through the Citrix SDK.

Working line in a normal CMD when variables are replaced with real values:

New-XAApplication -DisplayName "R2 - $agencyName" -ApplicationType ServerInstalled -CommandLineExecutable '"C:\Program Files (x86)\app\app.EXE" $sqlServer $db'

When trying to run this in a script, the line at "-CommandLineExecutable" it wants to literal the line, and use it to encapsulate the command... This causes the variables to not resolve.

I'll leave it at that just in case I'm missing something super simple. I've definitely tried a bunch of things.
My blog http://www.calegp.com

You may learn something!

Comments

  • RobertKaucherRobertKaucher A cornfield in OhioMember Posts: 4,299 ■■■■■■■■■■
    $path = "`"C:\Program Files (x86)\app\app.EXE`" $sqlServer $db"

    So
    $path = "`"C:\Program Files (x86)\app\app.EXE`" $sqlServer $db"
    New-XAApplication -DisplayName "R2 - $agencyName" -ApplicationType ServerInstalled -CommandLineExecutable $path
    

    So that is easier to read.
Sign In or Register to comment.