Shutdown Windows 10 remotely
There are a few hurdles I cam across when I was working through setting this up on my windows 10 Pro Desktop.
1. Firewall
If your Linux PC is on the same LAN and in the same IP subnet but is unable to connect to your windows desktop which is evident with returned errors talking of TIMEOUT then try disabling your firewall temporarily for troubleshooting.- Step 1: Open the Control Panel. Hold down the Windows key ( ) and press “X”. Select “Control Panel” in the menu.
- Step 2: Open Windows Firewall Settings. In the Control Panel select “System and Security” …
- Step 3: Disable the Firewall. Ensure that both the private and public network firewalls are turned off.
Change Network Category
Open PowerShell with administrative privileges
Run the following command:
Get-NetConnectionProfileSee the network name you want to change its type and run the following command:
Set-NetConnectionProfile -Name “NETWORKNAME” -NetworkCategory PrivateWhere NETWORKNAME is the name of your network and you can change the -NetworkCategory switch value to Public or Private.
TESTING
From your Linux PC try:
telnet <desktop.IP.Address> 445If this connects then the firewall is either disabled or configured to pass the RPC traffic through to your desktop.
Example of a successful connection
root@linux:~# telnet 192.168.0.65 445
Trying 192.168.0.65…
Connected to 192.168.0.65.
Escape character is ’^]’.
2. UAC (User Account Control)
If you run the ‘net rpc shutdown’ command and see a response similaar to this:Shutdown of remote machine failedTo solve this temporarily you could simply disable the UAC but this is certainly not a great position to leave your desktop. I am satisfied with the workaround provided below but you may think differently.
result was: WERR_CALL_NOT_IMPLEMENTED
The credit for the UAC workaround goes to Lowell Heddings, better known online as the How-To Geek.
By default your desktop doesn’t allow UAC elevation over the network with a local user account.
There’s a registry key that we can use to change this behavior to work the same as Windows XP. This will make your computer less secure, and I can’t recommend that you do this… but it’s also good to understand how Windows works.
Manual Registry Hack
Open regedit.exe through the start menu search or run box, and then navigate down to the following key, creating a new key if it doesn’t exist.
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System

To remove this tweak you can set the value to 0 or just delete the key.
3. Remote Registry Service
Another error that you may come across when running the ‘net rpc shutdown’ command is this:could not initialise pipe \winreg. Error was NT_STATUS_OBJECT_NAME_NOT_FOUNDTry running services.msc, scroll down to ‘Remote Registry and make sure it is set to automatic and started (running) then try again.
Linux PC
On your Linux PC use the following command (try apt-get install samba-common if its not already available).net rpc shutdown -I WIN.IP.ADDR -U USER%PASSWORDAll going well the Windows PC should advise the user they are being signed out and then shutdown.
In a future Post I will look at extending this to explain how to make Alexa shutdown the PC upon request using a script.
Nenhum comentário:
Postar um comentário