1

It's a fully updated 2008 R2 box running WMF 5.1. I've got a powershell script that, under normal circumstances, e-mails me on startup or shutdown. It's working fine on a different 2008 R2 box. On this new build, however, I'm not getting the e-mails on startup or shutdown. I do get them when I call it through the command line. I added them to the powershell section of gpedit.msc using the built-in Administrator account, which is, as of now, the only account on the machine. Checking HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy\Scripts in regedit reveals an empty key. I tried importing registry keys taken from the box where they're working, to no avail.

This is a standalone server. No domain. I'm open to ideas.

Logan Jones
  • 141
  • 3
  • `I added them to the powershell section of gpedit.msc using the built-in Administrator account` - I don't understand what that means. Do you mean you configured the Powershell Execution Policy in gpedit? – joeqwerty Aug 03 '18 at 16:31
  • 1
    Does `gpresult /h gpresult.html` show the script? – Greg Askew Aug 04 '18 at 14:38
  • No, joe. It means there are tabs in the startup and shutdown script dialogs specifically for powershell scripts. I ended up deleting the imported registry keys, deleting the scripts from the gpedit dialogs, and readding them through gpedit after a restart. They made it into the registry and worked after that. I still have no idea what happened. – Logan Jones Aug 04 '18 at 17:07
  • Can you throw a try/catch in the script and output in a file ? The exception message may give an insight what really happens when script runs automatically ? – Abhishek Mishra Aug 06 '18 at 12:30
  • The script wasn't running at all. Now that it is running, it works. For whatever reason, the gpedit gui wasn't actually adding the scripts to startup/shutdown even though it acted like it was. It hangs on "Shutting Down Group Policy Client" for ten minutes if there's a failing shutdown script. – Logan Jones Aug 07 '18 at 13:51

0 Answers0