PowerShell - The WinRM client cannot process the request.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-24-2015 04:18 AM
We are trying to execute the script below which creates a file or directory on the target CI:
Invoke-Command -ComputerName ${activityInput.targetCI} -Credential $cred -ScriptBlock {
Write-Host %%CreateDirectory%%
New-Item c:\temp\${activityInput.directory} -type directory
Write-Host %%
Write-Host %%CreateFile%%
New-Item c:\temp\${activityInput.file} -type file
Write-Host %%
}
When we run the script directly from MID server PowerShell console;
$UserName = "administrator_user"
$sec_password = convertto-securestring -string Password -asplaintext -force;
$Credentials = New-Object System.Management.Automation.PSCredential -ArgumentList $UserName, $sec_password
Restart-Computer -ComputerName 192.168.16.83 -Credential $Credentials -force
it runs fine.
When running the above custom activity script we get the following error message:
{
"hresult": null,
"output": "\n",
"errorMessages": "[192.168.16.83] Connecting to remote server 192.168.16.83 failed with thefollowing error message : The WinRM client cannot process the request. Defaultauthentication may be used with an IP address under the following conditions:the transport is HTTPS or the destination is in the TrustedHosts list, andexplicit credentials are provided. Use winrm.cmd to configure TrustedHosts.Note that computers in the TrustedHosts list might not be authenticated. Formore information on how to set TrustedHosts run the following command: winrmhelp config. For more information, see the about_Remote_Troubleshooting Helptopic.+ CategoryInfo : OpenError: (192.168.16.83:String) [], PSRemotingTransportException+ FullyQualifiedErrorId : CannotUseIPAddress,PSSessionStateBroken\n",
"eccSysId": "0c0f9ae30f3b02c06f2e42ace1050e3a",
"tags": {
"__text__": "\n"
}
}
- I would also like to confirm that PowerShell remoting is 100% enabled on CI server and we have verified it by running the script from PowerShell console on MID server.
- Credentials have been associated to the correct MidServer.
- From the ECC Queue the correct credentials are used by the mid server.
- Winrm is enabled on both the mid server and the target ci.
Would appreciate any input.
Thanks
- Labels:
-
Orchestration (ITOM)
-
Service Mapping
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-02-2015 03:01 AM
Hello Abdul,
Can you please provide me a screenshot of how you have configured your "Run Powershell" activity? What machine did you provide in the "Hostname" field? Did you provide the localhost (MID Server) address or the remote address?
You should be careful when using the "Invoke-Command" command, because when pointing in the "Hostname" field to the remote machine then you're basically trying to run the provided script already on the remote machine.
Kind regards,
Michel