Forum Discussion
Running remote commands in server
- Oct 23, 2023If you want to let Teamcity run a command on testserver, you must run it on the Teamcity server. You can't do a invoke-command in a scriptblock already running on a different server.
It's difficult to get the complete picture of the work flow that you're trying to achieve 🙂
Thanks. I am sorry for confusion
- Oct 23, 2023If you want to let Teamcity run a command on testserver, you must run it on the Teamcity server. You can't do a invoke-command in a scriptblock already running on a different server.
It's difficult to get the complete picture of the work flow that you're trying to achieve 🙂 - sohailalamOct 23, 2023Copper ContributorTestComplete is in TestServer and Teamcity is cloud based.
- Oct 23, 2023
But should you run this on both servers or not? If all the software is on testserver, then it should be:
$creds = Get-Credentials
Invoke-Command -ComputerName TestServer -Credentials $creds -ScriptBlock {c:\program files\xxxx\yyy\TestComplete.exe "E:\Projects\uw-web\uw-web\uw-web.pjs" /r /sl:"E:\Results\new-log.txt"}
And $commandtorun points to a shortcut, I guess? What is inside that shortcut? You should put that before the testcomplete.exe, and I gave an example above (Enter the full path to the .exe)You could also try :
$creds = Get-Credentials
Invoke-Command -ComputerName TestServer -Credentials $creds -ScriptBlock {cd "c:\program files\xxxx\yyy"
.\TestComplete.exe "E:\Projects\uw-web\uw-web\uw-web.pjs" /r /sl:"E:\Results\new-log.txt"
}
This way, you change to the directory and run testcomplete.exe.
- sohailalamOct 23, 2023Copper Contributor$creds = Get-Credentials
Declare $creds in Scriptblock
$RemoteServer = "TestServer"
$ProjectPath = "E:\Projects\uw-web\uw-web" # actual path of the project
# Define the command to run on the remote server
$CommandToRun = "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\SmartBear\TestComplete 15"
$CommandArguments = "$ProjectPath\uw-web\uw-web\uw-web.pjs /project:Smoke /r /sl:E:\Results\new-log.txt"
Invoke-Command -ComputerName TestServer,Local -ScriptBlock {$creds , TestComplete.exe "E:\Projects\uw-web\uw-web\uw-web.pjs" /r /sl:"E:\Results\new-log.txt"}
Do you think this command will kick off build in Teamcity and Run the project Uw-web of TestComplete which is in TestServer? - Oct 23, 2023Then you can add that between the brackets, let me know how it goes 🙂
- sohailalamOct 23, 2023Copper Contributoryes