Wednesday 25 May 2011

Running batch files from a GPO logon script

As you may or may not know if you're using GPOs, you can configure various scripts. Namely Logon, Logoff, Start and Shutdown.

For flexibility sake, you're often referring to other scripts inside this "master script" and often end up having to rewrite it a lot, because sometimes this not so important line you removed two months ago was actually making all the difference in the world.

One thing I noticed today (after quite some old school debugging, people using the __LINE__ in their favorite programming language know what I mean) , is that if you refer to a .bat file from your logon script, it will execute said script and stop processing the rest.


To remedy to this, call your script with:

start /B <path>\script.bat


Start will execute your called script as a new instance, and the /B flag will prevent any opportunistic window from showing up.

No comments:

Post a Comment