How to configure credentials to run Powershell commands on Remote server?

geethushanthosh
Kilo Contributor

Is that any way of configuring credentials at one time? Or we need to give every time when we run a command.

1 ACCEPTED SOLUTION

I don't have a lot of experience PowerShell remoting since we run most of our stuff on the local mid server using its service's credentials, but I think you need to pass the credentials in using the -credential parameter like:


-credential $cred



See this wiki for reference: Orchestration PowerShell Activities - ServiceNow Wiki



And this other community post has an example:


Unable to run remote command through Powershell


View solution in original post

5 REPLIES 5

Robert Beeman
Kilo Sage

Hello Geetha,



You can define alternative credentials by going to Orchestration > Credentials, selecting New, and then selecting Windows Credentials. If you don't specify, then it will try to use the MID Server's service credentials.



If your instance is old (like mine), the Credentials module might be in the Runbook Automation application instead of Orchestration:


find_real_file.png




Reference: Credentials - ServiceNow Wiki


Thanks Robert for your reply:)



I have set the credential value in Orchestration > Credentials under Windows Credentials. And also given the tag in powershell command. But still it is taking my MID server and giving below error.



Connecting to remote server failed with the following error message : Access is denied. For more information, see the about_Remote_Troubleshooting Help topic.+ CategoryInfo : OpenError: (:) [], PSRemotingTransportException+ FullyQualifiedErrorId : PSSessionStateBroken



find_real_file.png


I don't have a lot of experience PowerShell remoting since we run most of our stuff on the local mid server using its service's credentials, but I think you need to pass the credentials in using the -credential parameter like:


-credential $cred



See this wiki for reference: Orchestration PowerShell Activities - ServiceNow Wiki



And this other community post has an example:


Unable to run remote command through Powershell


Hi Geetha,



I see that you are using the -credential argument now in your other thread. Did it resolve this issue for you?