PowerShell script failure on remote execution

powershell

On executing a PowerShell Remote Script I am getting an error like following

Invoke-Command : Exception calling "ToXmlString" with "1" argument(s):
"The requested operation cannot be completed. The computer must be
trusted for delegation and the current user account must be configured
to allow delegation.

The exact line of code the execution is breaking is as follows:

$rsa = New-Object System.Security.Cryptography.RSACryptoServiceProvider
$key = $rsa.ToXmlString($true)

Can anybody help me to resolve this?

Best Answer

You need to enable credential delegation, so that PowerShell can pass your username/password to the remote computer, so that it can use them to perform the operation which is failing. See this answer on StackOverflow for instructions/details.

Related Topic