Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

powershell v2 remoting - How do you enable unencrypted traffic

I'm writing a powershell v2 script that I'd like to run against a remote server. When I run it, I get the error :

Connecting to remote server failed with the following error message : The WinRM client cannot process the request. Unencrypted traffic is currently disabled in the client configuration. Change the client configurati on and try the request again. For more information, see the about_ Remote_Troubleshooting Help topic.

I looked at the online help for about _ Remote_Troubleshooting, but it didn't point me towards how to enable unecrypted traffic. Below is the script that I'm using that is causing me problems.

Note: I have already run Enable-PSRemoting on the remote machine to allow it to accept incoming requests.
I have tried to use a session option variable, but it doesn't seem to make any difference.

$key = "HKLM:\SOFTWARE\Microsoft\PowerShell\1\ShellIds" Set-ItemProperty $key ConsolePrompting True  $tvar = "password" $password = ConvertTo-SecureString -string $tvar -asPlainText –force $username="domain\username" $mySessionOption = New-PSSessionOption -NoEncryption  $credential = New-Object System.Management.Automation.PSCredential($username,$password)  invoke-command -filepath C:\scripts\RemoteScript.ps1  -sessionoption $mySessionOption -authentication digest -credential $credential -computername RemoteServer 

How do I enable unencrypted traffic?

like image 437
Peter Walke Avatar asked Sep 24 '09 04:09

Peter Walke


1 Answers

AllowEncrypted is defined on the client end, via the WSMAN: drive. You must be running powershell.exe (or powershell_ise.exe) as an elevated process.

ps> cd WSMan:\localhost\Client ps> dir Name                      Value ----                      ----- NetworkDelayms            5000 URLPrefix                 wsman AllowUnencrypted          false Auth DefaultPorts TrustedHosts 

You would change it like so (after changing to the directory above):

ps> set-item .\allowunencrypted $true

Hope this helps,

  • Oisin
like image 163
x0n Avatar answered Sep 20 '22 19:09

x0n