Powershell runner arguments around the wrong way?
I want to be able to pass into my powershell scripts some arguments.
However when specifying arguments they seem to be inserted before the command Eg
C:\Windows\system32\cmd.exe /c C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe -NonInteractive <ARGUMENTS> -Command - <C:\TeamCity\buildAgent\work\288556b63f9a070b\Scripts\Build\VersionGlobalAssembly.ps1 && exit /b %ERRORLEVEL%
Should it not be this instead ?
C:\Windows\system32\cmd.exe /c C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe -NonInteractive -Command - <C:\TeamCity\buildAgent\work\288556b63f9a070b\Scripts\Build\VersionGlobalAssembly.ps1 <ARGUMENTS> && exit /b %ERRORLEVEL%
Or am I misunderstanding how this is suppose to work?
I am using the latest 6.5.1 version
Thanks
David
Please sign in to leave a comment.
Hi David
Change Script execution mode option to Execute with -File, then script arguments can be specified in special setting.
Make sure that execution policy allows to run your scripts.
Also, you can use build parameters and TeamCity system properties right within the scripts.
Michael
I tried running in this mode however I get execution of scripts is disabled.
I have logged into our server as admin and Set-ExecutionPolicy to RemoteSigned and did a reboot but I still get the same error.
Running Win2008 R2.
Thanks
David
Oops forget about this I did not have it set to 64 bit!
Message was edited by: David Wong
so, did it help with?
Yes setting to 64bit worked
Hello,
Regarding this: "Also, you can use build parameters and TeamCity system properties right within the scripts."
How can this be done? I can't find any documentation explaining how to access TeamCity system properties within Powershell scripts. I have tried printing out all the session variables and do not see any system properties passed from TeamCity. Can you describe how this is done in a ps1 script or point me to some documentation please?