Forum Discussion
sohailalam
Oct 23, 2023Copper Contributor
Running remote commands in server
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...
- 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 🙂
Oct 23, 2023
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.
sohailalam
Oct 23, 2023Copper Contributor
As you can see I have written 2 computer names, TestServer and Local. Do I really need to write both or just TestServer? And for Credential, I should be writing the credential for TestServer right? Help is highly appreciated. Thanks
- Oct 23, 2023You specify the Computer or Computers in the -Computername parameter. If you don't specify the -Computername parameter, it will run the ScriptBlock locally. Identify the computer(s) on which the -ScriptBlock command should run, use the -Computername parameter, and separate computers using commas. (See it as if you would log into that server and enter the commands manually there.)
For the Credential, you should enter the username and password for the server you want to let the Scriptblock run on. (Same credentials that you use to login to that machine I guess) Specify it like Domain\Username and password or Computername\Username and password- sohailalamOct 23, 2023Copper ContributorFrom my understanding, If I run the following command,
Invoke-Command -ComputerName TestServer, Local Computer -ScriptBlock {Get Credential}, it will run the TestComplete which is in TestServer to the Local Computer? And then we only have to specify Username and Password of TestServer, right?
And what happens if I only use this Invoke-Command -ComputerName TestServer -ScriptBlock {Get Credential}, this means it will run the command in TestServer only right?
Thanks- Oct 23, 2023https://www.youtube.com/watch?v=1vUs_EO1AN4 is also lovely to watch and learn more.