> Good morning!
> This is specifically for Richard Mueller (whose scripts I 'steal' all the
> time!) regarding one of his logon scripts.
> Richard, I use "logon3" (http://www.rlmueller.net/Programs/Logon3.txt for
> those of you not familiar with his site) from your web site and it works
> very well. I do a lot of things with Security Groups and this specific
> logon script is awesome. I modify it to fit each environment and away we
> However, there are two questions that I have regarding it that I can not
> seem to understand:
> 1) if the client has previously mapped network drives (either manually
> mapped or via a .bat/.cmd logon script) when I implement your logon script
> we have a hard time with the "old" mappings going away. About the only
> way that we can resolve this issue is to manually connect to the machine
> and disconnect the old mappings. What am I doing wrong?
Logon3.vbs has a MapDrive function to handle conflicts if the user has
persistent connections. The function first attempts to map the specified
drive and traps any errors. If there is an error the function then removes
any existing mapping. The first "True" parameter on the RemoveNetworkDrive
method means to remove the mapping even if it is in use. The second "True"
specifies that the removal is persistent (if the mapping was persistent, the
registry setting that makes the mapping persistent is removed). Perhaps this
later functionality no longer works on the newer clients, since registry
permissions are much tighter. I will need to investigate. The function
worked fine when I tested on clients up to XP.
Note that the script only removes mappings that conflict with the mappings
specified in the logon script. If you want to remove all existing mappings
(whether or not they conflict with the logon script), you can use the
EnumNetworkDrives function of the wshNetwork object. I believe the code
Set objNetwork = CreateObject("Wscript.Network")
Set objDrives = objNetwork.EnumNetworkDrives
For j = 0 To objDrives.Count - 2 Step 2
objNetwork.RemoveNetworkDrive objDrive(j), objDrive(j + 1)
This won't help you if the RemoveNetworkDrive function is not working for
> 2) the section on the printers - I was really excited about that part.
> Then I looked at it. I have a couple of clients who - for a lot of
> different good reasons - have locked down their printes to specific users.
> I accomplished this via Security Groups. I was tring to map the printers
> based on USER group membership. It appears that this script is intended
> for using security groups of which the COMPUTER is a member. Is there a
> way to 'modify' this so that the focus is on the USER group membership?
> Thanks! I really appreciate all of the time that you spend helping the
> scripting - challenged (like me....but I am working on it).
The part of the script that maps printers according to computer group
membership can be easily modified for user group membership. Simply pass the
object reference objUser instead of objComputer to the IsMember function in
logon3.vbs. In fact, there is no longer any need to bind to the objComputer
object. The code that retrieves the DN of the computer object (and assigns
to strComputerDN) can be removed, and the code that binds objComputer can be
removed. Simply remove all lines referring to strComputerDN or objComputer
(after replacing objComputer with objUser in all calls to IsMember). I hope
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net