2

According to this article, group policy is processed in descending order through the organization (ie start at forest, then domain, ou, etc). I have one GPO linked to the domain which runs a startup script to delete all mapped network drives; then I have various GPO's linked to OU's which map certain drives for certain groups. The problem is, the scripts which map the drives finish before the script which unmaps them! Can I fix this?

4
  • 1
    Why don't you abandon your GPO to unmap drives, and perform the unmapping in the same scripts as the mapping?
    – Bryan
    May 1, 2012 at 6:51
  • We restructured sharing and access rights recently and I want to ensure we get rid of any old drive references. (The users will already get access denied if they click on it, but I don't want the drive to show up in their my computer at all). May 1, 2012 at 9:54
  • 1
    net use z: /d, net use y: /d, net use x: /d, etc at the start of each logon script that maps the drives.
    – Bryan
    May 1, 2012 at 12:08
  • 2
    Another possible solution is to use Group Policy Preferences for drive maps, however you don't state what client you are using, I've had mixed results with this on Windows XP and Group Policy Preferences, but on Win 7, it works fine. It also allows you to delete all existing drive maps before applying the new drive maps.
    – Bryan
    May 1, 2012 at 12:11

3 Answers 3

1

use Group Policy Preferences for drive maps (as Bryan commented). Much cleaner. I used it with XP, worked fine, now with Win 7 same. Logon scripts are so 2004.

0

Group policy is processed in order of link scope, yes. However, the 'processing' means determining which policies apply from which GPO, and which are overridden by a higher priority, more specific link, or enforce-mode GPO.

Startup scripts are not executed synchronously in the order of the GPO processing - they're not executed during the processing step at all. If you need to enforce a dependency order in your startup scripts, you'll need to do it in some other way.

As mentioned, clearing drive mappings before you apply them in the same script is a good option.

0

If you were really hurting, and you hate yourself, you could use "tasklist" in XP or 7 to find out if there are other CMD.EXE sessions running and "sleep" until they are done. I guess you could set the WINDOWTITLE in the domain script and search for it with something like: tasklist /FI "IMAGENAME eq cmd.exe" /FI "WINDOWTITLE eq TESTING" /FO CSV

You'd have to loop over it with a few seconds sleep each time till it disappeared. Or you could just sleep for a minute and hope the other one doesn't take that long.

Makes me kinda ill to suggest it, though. ;-)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .