Logon scripts - cmd / batch
I have admin priviledges on my workstation. That being said: I am trying to create a logon script that executes when I log in. (easily done via task manager / via registry) The part I'm having trouble with is 'the script'. I need the registry value to be set to zero, and if at any time during startup it changes to 1, for the script to change it back to 0. I presume a batch script with an 'if' statement in combination with 'reg compare' or 'reg query', but I cannot figure out how to check those results in an 'if' statement. Any help / insight is appreciated. -Aaron
February 11th, 2010 9:33pm

Manipulating text and doing string compares in NT shell scripts sucks. Why do you want to bother checking if the value is different? Just overwrite the value with 0 and move on.Kurt Dillard http://www.kurtdillard.com
Free Windows Admin Tool Kit Click here and download it now
February 16th, 2010 5:03am

The reason why I need to compare the value is that during the begining of the logon process, the value is 0. But once the GPO settings come down, then the value changes to 1. So I want the script to wait until the value changes to 1 before changing it back to 0. (as an arbitrarily delayed timer is too innaccurate) If there was a way to return the registry value, it should be straight forward enough to assign that to something like: %1 = registry value :StartCheck sleep10 if %1 = 0 GOTO StartCheck :SetToOne registry value = 0 End Or am I way off base with this idea?
February 20th, 2010 12:45am

The GPO is going to overwrite the value ever time its refreshed, 90 minutes by default. Why don't you change the GPO instead?Kurt Dillard http://www.kurtdillard.com
Free Windows Admin Tool Kit Click here and download it now
February 20th, 2010 3:34am

Unfortunately I'm not allowed to edit the GPO. So my solution has to be wholely contained within my box. I can't remember specifically what the refresh rate is (probably ~8hrs / so, we are a larger organization, 10,000+ active users), but running a script similar to what I outlined above every time I log in would suffice.
February 20th, 2010 4:04am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics