Powershell Help
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.
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.
Comments
-
RobertKaucher Member 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.