I've followed the directions at the bottom of this post on adding a Group Policy Shutdown PowerShell script, but it does not execute it during shutdown.
Run powershell script whenever a server reboot is initiated and show the script progress in cmd
When I run it manually, it executes correctly.
I think this has to do with it using Invoke-WebRequest in the script and perhaps the network connection is already shutdown before this script is executed.
I'm trying to turn off a Sonoff Switch running Tasmota. And as I said, it works properly when run manually:
$Response = Invoke-WebRequest -URI http://sonoff-magni.asgard/cm?user=xxxx"&"password=yyyyyyy"&"cmnd=Power%20Off
I've fully qualify the path to the ps1 script and even tried putting double-quotes around the path.
Still no joy. Any ideas?
Thanks!