So my new love is PowerShell and as I like to spend my time (or whenver I get the chance) in CLI mode, anything is welcome!
Anyway, let’s get down to business. So Windows Server 2012 has been installed in my Virtualbox environment and I opted for the CLI mode (non-GUI) right from the start. Hey, if Microsoft are offering two install modes – CLI or GUI then I am assuming that you can do everything in both modes right?
And as PowerShell is native on Windows 7 and Windows Server 2012 why not remote in through PowerShell from your client workstation? Similar to SSH into your newly built *nix server eh? 😉
0. Open PowerShell by running powershell in the CMD window or by starting it from the Start Menu shortcut
1. Make sure that WinRM service is running – which it should be by default on Server 2012
PS C:\Users\Administrator\Documents> Get-Service WinRM Status Name DisplayName ------ ---- ----------- Running WinRM Windows Remote Management (WS-Manag...
2. Next we’ll enable remoting
PS C:\Users\Administrator\Documents> Enable-PSRemoting -force WinRM is already set up to receive requests on this computer. WinRM has been updated for remote management. Configured LocalACcountTokenFilterPolicy to grant administrative rights remotely to local users
3. And then on your client workstation fire up PowerShell and for starters we’ll add “Everything” to our TrustedHosts file so that we can connect to wherever we want:
PS C:\Users\ePlus> Set-Item WSMan:\localhost\Client\TrustedHosts -Value "*" -Force
4. Then we’ll start a PSSession, but I know we could have done Enter-PSSession instead of New-PSSession:
PS C:\Users\ePlus> New-PSSession -ComputerName 192.168.1.110 -Credential administrator Id Name ComputerName State ConfigurationName Availability -- ---- ------------ ----- ----------------- ------------ 7 Session7 192.168.1.110 Opened Microsoft.PowerShell Available
5. And finally we’ll connect to the newly created PSSession and we’ll get the destination IP address as confirmation when we have successfully connected:
PS C:\Users\ePlus> Enter-PSSession 7 [192.168.1.110]: PS C:\Users\Administrator\Documents>