Imagine, you are working on perfectly good workstations, enjoying your GUI and you get a task to perform some maintenance on Windows Server, that has the “User interfaces and infrastructure” feature removed.
One way is to utilize PowerShell, the task automation, and configuration management framework developed by Microsoft about 10 years ago.
So to initialize remote PowerShell session, it takes:
- On the targeted server/ computer type:
- Enable-PSRemoting -Force //will change the needed configuration settings
- Or you can set a GPO, as shown here.
- On your machine enter:
- $cred = Get-Credential // get your domain credentials
- $rhost=”olp-dc2″ // setting the value for remote host
- Enter-PSSession -ComputerName _._.com -Credential $cred // fill out the computer name and the name of the user you want to use
- hostname // to check if you are running PowerShell in the host
- Get-PSSession //
- Enter-PSSession –ComputerName _._.com -Credentials $cred // to switch to another PowerShell session
- Exit-PSSession // will kill the PowerShell session, as well as typing just exit
- Get-PSsession $computer-name // will show you the ongoing sesions
- Or just type exit to leave the session.
And as visable, powershell wont let you forget which session you are working in right now :).