Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Send an email in a shutdown script using batch file that calls an executable

$
0
0

I started out with what I thought was a simple task.  I wanted to get an email if my building looses power and when it comes back online. My mail is web based but allows smtp and I have an executable called mailsend.exe.  I created a batch file (.bat) with the fully qualified path to the exe with desired parameters.  I can run the batch file from a command prompt without any problem.  I get the email.  Next was to add it as a shutdown script in the Group Policy Editor.  My problem is that I don't know the order that things get killed during a shutdown.  Is the script (batch file) the first thing to happen on a shutdown?  The last thing?  Is it synchronous?  Asynchronous? How to I ensure the resources needed to execute the batch file will not be destroyed before I can run them or that they get forced to shutdown before they are complete?  Also, in the batch file, I am simply putting the exe (fully qualified) with parameters.  Is that safe or can I only use command mode internal commands?

Thanks in advance!


Viewing all articles
Browse latest Browse all 15028

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>