Friday 28 August 2015

Remoting into Windows Server 2003/2008/2012 using Powershell / PSSession

On the server you wish to remote to we should ensure that the server is setup for powershell remote session (e.g. firewall etc.) by running the following from powershell:
Enable-PSRemoting
and authorize the connecting machine (the Windows 7 box) to connect to the server instance:
Set-Item wsman:\localhost\Client\TrustedHosts client.my.domain -Concatenate -Force
We then initiate the session with:
$securePassword = ConvertTo-SecureString "Password" -AsPlainText -force
$credential = New-Object System.Management.Automation.PsCredential("domain\username",$securePassword)
$session = New-PSSession -ComputerName Remote2003Server -authentication default -credential $credential
Enter-Pssession $session

0 comments:

Post a Comment