Monday, March 09, 2020

Setting up and configuring wol and rpc remote shutdown for windows clients

If your looking for an inexpensive way to setup an automatic turning on and shutting off of your windows computer systems, using WOL and RPC are an excellent way to do that, you can even setup a Linux server for controlling the timing for turning the systems on/off and it isn’t too difficult to manage. I will do a post soon about setting up a linux server to run WOL and RPC Shutdown scripts. If your looking to set one up the quick and dirty version is:

Requirements SAMBA, Windows Admin and Password, Linux Admin and Password

Put startup/shutdown scripts in /etc/cron.daily

Startup
sudo -i -u $linuxAdminUser -p $password wakeonlan -i $IPADDRESS $MACADDRESS

Shutdown
sudo -i -u $linuxAdminUser -p $password net rpc shutdown -I $IPADDRESS -U $WindowsADM%$password -t 1 -f

Use Crontab to setup scheduling


Crontab schedule

For more information about crontab, you can visit this link about crontab


Here are the break down of the examples above


00 12 * * 5 user command

at minute 00, hour 12, * - no value (day of the month), * - no value (month), 5  the fifth day of the week (friday), user to run the script and script to run.

So the following example "00 12 * * 5 root /etc/cron.daily/shutdown.sh"

at minute 00, at 12 pm, on friday run as root the script shutdown in /etc/cron.daily


Setting up the Windows 10 Client


For setting up WOL/RPC shutdown, you have to have your windows clients prepped with the proper firewall rules and user accounts for privileged access.


  • An administrator account (not called administrator as windows 10 upgrades disables this with each update)
  • RPC and Remote Access Firewall Rules Allowing (I also allow ICMP and Ping) for remote management with services such as lansweeper and FOG
  • Updated Intel network driver

One thing I have noticed recently is that the manufacturer driver doesn’t seem to work with WOL.  Working with some Lenovo m93 and m900 series and and HP {put hp model here} doing a full windows reinstall/reset breaks WOL.  Even getting an up-to-date manufacturer driver WOL doesn’t seem to work which is extremely odd. A major difference I can account for this is the update to the intel proset tools for their network driver which brings a GUI interface back to add and remove VLANs to Windows 10.

Nic Driver settings to enable WOL in Windows 10

Enable WOL in Windows 10.  In Windows 7 unchecking the computer to turn off the device would leave the device on but in windows 10 it disables all power management and turns it off.  For WOL to work you have to enable "Only allow a magic packet to wake the computer option"

Wake on Link Settings - Disabled


Wake on Magic Packet - Endabled


Wake on Pattern Match - Enabled



Wait for Link - Auto

Even with these settings being enabled and no errors WOL would not go.  I had S3, S4 and S5 enabled in the bios, which would enable WOL to work, but when I send the WOL packet the system stays off.



Version 25 of the Intel network driver and proset tools


Intel Proset software and drivers


Adapter driver Options


Teaming and Vlans
Once I updated the driver to version 25 WOL started working for my windows client.

RPC shutdown from Linux

sudo -i -u $linuxAdminUser -p $password net rpc shutdown -I $IPADDRESS -U $WindowsADM%$password -t 1 -f


RPC SHUTDOWN ERROR
To fix this issue


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
Change the LocalAccountTokenFilterPolicy to 1



On the right-hand side, add a new 32-bit DWORD value named LocalAccountTokenFilterPolicy and set the value to 1.
To remove this tweak you can set the value to 0 or just delete the key.
With this setup you will be able to startup and shutdown any pc you have listed in your startup and shutdown scripts.



References


How to fix CURL call imporitng an RSS feed on a site blocking CURL calls

There is a 3rd party service provider that my organization uses called bibliocommons.  They have these nice book carousels.  However the car...