$config_init ='
$rloc = "C:\Program Files\Path\Path2\"
Set-Location $rloc
.\app.exe
proprietary app.exe command #1
proprietary app.exe command #2
proprietary app.exe command #3
proprietary app.exe command #4
'
Invoke-VMScript -ScriptText $config_init -VM MyvM -GuestUser Administrator -GuestPassword Password
Also tried setting the location and running the app all in one like:
& "C:\Program Files\Path\Path2\app.exe"
Both return errors.
Any assistance would be great
Thank you
Can you try adding the Verbose switch to the Invoke-VMScript cmdlet?
And share the output you see.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
It hangs here indefinitely after submitting the command:
VERBOSE: 7/27/2017 11:21:39 AM Invoke-VMScript Started execution
VERBOSE: Performing the operation "Invoke-VMScript" on target "RB"
VERBOSE: 7/27/2017 11:21:39 AM Invoke-VMScript Finished execution
When I run each of these commands letter for letter directly in PS it works perfectly.
Its as if Invoke-VMScript doesnt want to start reading the commands
Those apps you are starting in the guest OS, they don't wait for some input or so?
Can you doing a simple script in the guest OS, perhaps just a Get-Service?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
The input is in the 'script' im passing through from Invoke-Script.
I can manually run through the commands word by word in a PS session on the guest, just not when starting from Invoke-Script
I understand that, but can you just run a simple PowerShell cmdlet through the Invoke-VMScript cmdlet?
Just to be able to determine if it is a general Invoke-VMScript cmdlet issue, or something related to the actual script you are trying to run.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Ah, sorry for the confusion. I have the Invoke-Script running elsewhere in a larger script properly, so it looks like its exclusively here that its not functioning properly.
Other instances include setting time in windows, netsh commands etc.
Ok, so the issue is only happening on this station it seems.
Now to determine if it is a general Invoke-VMScript issue on that station, or something with the specific script you are running through Invoke-VMScript, can you run a simple one-liner, single cmdlet script on this station through Invoke-VMScript.
That's why I asked if you could run for example 'Get-Process' through Invoke-VMScript.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Forgot to update on Friday..
The Get-Property or other commands worked with this piece. I ended up calling the commands individually like such and it works properly:
$scriptname = '
& 'Path\app.exe' command
& 'Path\app.exe' command
& 'Path\app.exe' command
'
Invoke-VMScript $scriptname
Ok, good to hear
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference