Coming Soon: GET:IT Endpoint Management 1-Day Conference on September 28th at 9:30 AM ET Coming Soon: GET:IT Endpoint Management 1-Day Conference on September 28th at 9:30 AM ET
PowerShell|Windows 10|Windows Client OS

Shut Down Remote Workgroup Computers

In today’s Ask the Admin, I will show you how to shut down a remote workgroup computer using PowerShell.



Sponsored Content

Say Goodbye to Traditional PC Lifecycle Management

Traditional IT tools, including Microsoft SCCM, Ghost Solution Suite, and KACE, often require considerable custom configurations by T3 technicians (an expensive and often elusive IT resource) to enable management of a hybrid onsite + remote workforce. In many cases, even with the best resources, organizations are finding that these on-premise tools simply cannot support remote endpoints consistently and reliably due to infrastructure limitations.

The easiest way to shut down remote Windows 10 devices in a workgroup is by using the PowerShell Stop-Computer cmdlet. This is for those that are not part of an Active Directory domain. Before you can use it, you will need to perform the following three steps on each remote device:

  1. Enable file and printer sharing.
  2. Enable remote administration firewall exceptions.
  3. Change UAC policy for remote administrators.

Enable File and Printer Sharing

Before you can run psshutdown against a remote machine, you will need to enable file and printer sharing on each remote device that you want to shut down. File and printer sharing is disabled by default on workgroup devices. The quickest way to achieve this is by using the command prompt. You will need to open a PowerShell prompt with administrative privileges and run the command below:

netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=yes

Enable Remote Administration

Stop-Computer uses Windows Management Instrumentation (WMI) and requires some firewall ports to be open on each remote device. The following command is deprecated but it still works. It seems to be the only easy way to enable the necessary firewall exceptions for remote administration on a workgroup Windows 10 device.

netsh firewall set service type=remoteadmin mode=enable

Change UAC Policy

UAC strips administrator accounts, which connect remotely, of their admin privileges by default. Keep in mind these connect remotely. You can change this behavior by adding the LocalAccountTokenFilterPolicy value to the registry and setting it to true.

Modify default UAC policy in Windows (Image Credit: Russell Smith)
Modify Default UAC Policy in Windows (Image Credit: Russell Smith)

$registryPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" 
$Name = "LocalAccountTokenFilterPolicy" 
$value = "1"

New-ItemProperty -Path $registryPath -Name $name -Value $value -PropertyType DWORD

Shut Down a Remote Computer

Once the above prerequisites are in place, start a PowerShell prompt on your management workstation. Run the Stop-Computer cmdlet as shown below and set the -Computer parameter to the name of the remote device you want to shut down. Set -Credential to the name of a user account on the remote device that has local administrative privileges or the right to shut down the computer.

Stop-Computer -Computer desktop-qghidoo -Force -Credential "russell smith"

You can shut down more than one device at a time by specifying multiple computers in the -Computer parameter.

In this Ask the Admin, I showed you how to shut down remote Windows 10 workgroup devices using PowerShell.


Don't have a login but want to join the conversation? Sign up for a Petri Account

Comments (1)

One response to “Shut Down Remote Workgroup Computers”

  1. <p>Just used this.</p><p><br></p><p>When you enact the Script you get a popup credentials box into which you must then input the password for the administrative privilege holding account you used in the script that it then uses to send the command to the remote device.</p><p><br></p><p>The remote workgroup computer then summarily shuts down without even a whimper or warning.</p><p><br></p><p>+1 Will use again and again and again.</p><p><br></p><p><br></p>

Leave a Reply

IT consultant, Contributing Editor @PetriFeed, and trainer @Pluralsight. All about Microsoft, Office 365, Azure, and Windows Server.