Oct 23 2023 10:40 AM
I have TestComplete in my Server name: TestServer and I would like Teamcity to run the TestComplete Projects which is in Server: TestServer. I did some research and found Invoke-Command -ComputerName TestServer, Local Computer -ScriptBlock {}. I am confused on how to use this and I am new to Powershell. Help is highly appreciated.
Oct 23 2023 10:59 AM - edited Oct 23 2023 11:00 AM
You can place the commands you want to run inside the ScriptBlock part, and you can use invoke-command with the -Credential (Get-Credential) parameter to get a pop-up in which you can enter the credentials for the test server.
Please click Mark as Best Response & Like if my post helped you to solve your issue.
This will help others to find the correct solution easily. It also closes the item.
If one of the posts was helpful in other ways, please consider giving it a Like.
Oct 23 2023 11:16 AM
Oct 23 2023 11:30 AM
Oct 23 2023 12:00 PM
Oct 23 2023 12:05 PM
Oct 23 2023 12:07 PM
Oct 23 2023 12:19 PM
Oct 23 2023 12:26 PM
Oct 23 2023 12:43 PM
Oct 23 2023 12:51 PM
Oct 23 2023 01:16 PM
Oct 23 2023 01:24 PM - edited Oct 23 2023 01:26 PM
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.
Oct 23 2023 01:30 PM
Oct 23 2023 01:39 PM
SolutionOct 23 2023 01:39 PM
Solution