Thursday, November 19, 2009

PS Remoting to Home Server

I wanted to PowerShell remote to my home server, but as it is – for the good reason, that it is impossible – not in the domain of my PC, I have to add it to TrustedHosts.

This is my story.

First, I enabled PS remoting on the home server with a simple

Enable-PSRemoting





Next, I attempted to access the server




enter-pssession server -cre server\administrator





By doing so, I received a very long error message.



I tried with –authentication negotiate. This reduced the error message to 10 lines ;) It told me to configure TrustedHosts with Winrm.cmd.



I looked at Winrm.cmd, but that looked very complicated and this is at the end of the day. Luckily, the WSMAN drive popped up in my mind. I switched to my administrative account and did this




PS C:\Users\user> cd wsman:
PS WSMan:\> dir

WSManConfig:

ComputerName Type
------------ ----
localhost Container

PS WSMan:\> cd .\localhost
PS WSMan:\localhost> dir


WSManConfig: Microsoft.WSMan.Management\WSMan::localhost

Name Value Type
---- ----- ----
MaxEnvelopeSizekb 150 System.String
MaxTimeoutms 60000 System.String
MaxBatchItems 32000 System.String
MaxProviderRequests 4294967295 System.String
Client Container
Service Container
Shell Container
Listener Container
Plugin Container
ClientCertificate Container


PS WSMan:\localhost> cd .\Client
PS WSMan:\localhost\Client> dir


WSManConfig: Microsoft.WSMan.Management\WSMan::localhost\Client

Name Value Type
---- ----- ----
NetworkDelayms 5000 System.String
URLPrefix wsman System.String
AllowUnencrypted false System.String
Auth Container
DefaultPorts Container
TrustedHosts System.String


PS WSMan:\localhost\Client> Set-Item .\TrustedHosts server

WinRM Security Configuration.
This command modifies the TrustedHosts list for the WinRM client. The computers in the TrustedHosts list might not be authenticated. The
client might send credential information to these computers. Are you sure that you want to modify this list?
[Y] Yes [N] No [S] Suspend [?] Help (default is "Y"): y
PS WSMan:\localhost\Client>









Back to my standard user




194 WSMan:\localhost> enter-pssession server -cre server\administrator
[server]: PS C:\Documents and Settings\Administrator\My Documents>







and it worked.



 



Happy remoting

No comments: