Today I was to lazy to walk to my pc and turn it off. I had my laptop next to me and normally I use remote desktop to connect to the pc and open a command line and shutdown /s
Today I thought to use powershell. I need to use it more any way..
To setup a connection and put in commands on the remote pc. Use the following command
Enter-PSSession -Computername <name of pc> -Credentials <username>
A popup will come up to put in the password. It will then connect to that pc and you can start typing in commands. As if you where sitting behind that PC
In my case I had already have setup the winrm on the remote computer. If you can’t connect then you need to use the following command line on the remote computer
Enable-PSRemoting -Force
This command starts the WinRM service, sets it to start automatically with your system, and creates a firewall rule that allows incoming connections. The -Force part of the command tells PowerShell to perform these actions without prompting you for each step.
Recent Comments