Hi Guys,
I have had a look through the various threads talking about powershell but am struggling to get my script to launch properly.
I intend to have a serious of combo selection boxes populated from an INI file and then when a user hits the "launch" button it uses the selected options to launch the powershell script with those parameters.
This line works great from a command prompt:
C:\windows\system32\WindowsPowerShell\v1.0\PowerShell.exe -noexit -STA -Command "& 'C:\Program Files\ApplicaionDir\TAME\HRMenu\Start\Start.ps1' -engine Server01.domain.local -session TAME_TEST -stage DEV -useCredential 'Server01\'"
Iv tried running it as a single line but that doesnt seem to work for me as it doesnt seem to pass through properly. Iv resorted to using it as a group of variables so i can check the command is passed correctly:
$start = '"C:\Windows\System32\windowspowershell\v1.0\powershell.exe" -noexit -STA -Command'
$middle = '"C:\Program Files\ApplicationDir\TAME\HRMenu\Start\Start.ps1"'
$end = '-engine Server01.domain.local -session TAME_TEST -stage DEV -useCredential "Server01\"'
ConsoleWrite(@ComSpec & ' /c ' & $start & ' ' & $middle & ' ' & $end)
Run(@ComSpec & ' /c ' & $start & ' ' & $middle & ' ' & $end, @SystemDir, @SW_HIDE)
The console write above looks correct but the run command doesnt run.
Can anyone help me correct it? (I am assuming the quotes are half of the problem)
Apologies for the lack of knowledge I have vague knowledge of how AutoIt works but have always had issues getting commands passed through correctly. Powershell however.... this is a first attempt but that part is working fine i just cant launch it using AutoIT at the moment.
Thanks
Dan
I have had a look through the various threads talking about powershell but am struggling to get my script to launch properly.
I intend to have a serious of combo selection boxes populated from an INI file and then when a user hits the "launch" button it uses the selected options to launch the powershell script with those parameters.
This line works great from a command prompt:
C:\windows\system32\WindowsPowerShell\v1.0\PowerShell.exe -noexit -STA -Command "& 'C:\Program Files\ApplicaionDir\TAME\HRMenu\Start\Start.ps1' -engine Server01.domain.local -session TAME_TEST -stage DEV -useCredential 'Server01\'"
Iv tried running it as a single line but that doesnt seem to work for me as it doesnt seem to pass through properly. Iv resorted to using it as a group of variables so i can check the command is passed correctly:
$start = '"C:\Windows\System32\windowspowershell\v1.0\powershell.exe" -noexit -STA -Command'
$middle = '"C:\Program Files\ApplicationDir\TAME\HRMenu\Start\Start.ps1"'
$end = '-engine Server01.domain.local -session TAME_TEST -stage DEV -useCredential "Server01\"'
ConsoleWrite(@ComSpec & ' /c ' & $start & ' ' & $middle & ' ' & $end)
Run(@ComSpec & ' /c ' & $start & ' ' & $middle & ' ' & $end, @SystemDir, @SW_HIDE)
The console write above looks correct but the run command doesnt run.
Can anyone help me correct it? (I am assuming the quotes are half of the problem)
Apologies for the lack of knowledge I have vague knowledge of how AutoIt works but have always had issues getting commands passed through correctly. Powershell however.... this is a first attempt but that part is working fine i just cant launch it using AutoIT at the moment.
Thanks
Dan