I have 2 batch files that send emails intended to notify of a server shutdown or startup. The batch files call an exe with a single argument, the message to be sent. The exe comes from a vb.net program using system.net.mail.
The batch files work properly from a command prompt and emails are received.
Now I want these batch files to run automatically when the OS starts and when the OS is being shutdown, without any user having to log on.
I tried testing this on a Win 8.1 machine which I believe should work the same as on Server 2012 R2. If this is a bad assumption, please advise.
So here's what I tried:
1) Task Scheduler (but only for startup, there's no shutdown option)
2) Local Group Policy Editor > Computer Configuration > Windows Settings > Scripts (Startup/Shutdown)
In both cases the setup seemed pretty straightforward, but the emails are never sent.
Can someone give me ideas about considerations I clearly am not thinking about?
Is the problem permissions? How would I know that?
Is the problem "It looks scheduled but isn't"?
Is the problem that batch files can't be used in this way?
Since this is my first time doing this, I'm pretty certain I'm missing something basic.