Tuesday, 17 March 2015

Using PowerShell Enter-PSSession when your computer isn't on the domain.

Quite often when i'm at a customers site I need to work on their servers. Each time I go to site I don't join my laptop to the customers domain. The problem with this is that when you use the Enter-PSSession command you get an error message about the fact that your computer is not joined to the domain that the server is.

This also presumes you have enabled PSRemoing on the destination host with this command:

Enable-PSRemoting -Force

Here is the work around; Enter the first command on you computer once only. This tells your computer to trust the identify of any remote computers. This should not be done on non technical users computers as the security implications are obvious.

Set-Item WSMAN:\Localhost\Client\TrustedHosts -Value * -Force

The command below will connect you to the computer of your choice, you will need change the IP address or substitute a computer name, you will also need to change the domain and username to an account that is active on the server.

Enter-PSSession -ComputerName 0.0.0.0 -Credential domain\username -Authentication negotiate


No comments:

Post a Comment