HELP!!! Logon script not processing Group membership or personal drive mapp

By 1bn0 ·
I have a vbs logon script that mapps drive letters based on group membership. Some of the drives are just mapped for everyone.

The straight drive mappings work O.K.
The drive mappings based on group membership are not happening.

The clients are also failing to get the drive mapping for the personal drive.e.g P: gets set to \\server1\%UserName%. This is configured in the user profile in ACtive Directory Users and Computers.

excerpt from script:

'Delete ALL current drive mappings
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run ("net use * /delete /yes")

'Wait six seconds so the drive disconnects complete.
WScript.sleep 6000

'Map network drives
MapIt "G:","\\server1\shared"

If IsAMemberOf(objNetwork.UserDomain,objNetwork.UserName,"Accounting") Then MapIt "I:","\\server1\ACCT"

MapIt "Q:","\\server\apps"

If IsAMemberOf(objNetwork.UserDomain,objNetwork.UserName,"Managers") Then MapIt "R:","\\server1\SmartBoard"

The script was orignally generated using Sapien Technologies free Logon Script Generator. Then edited manually.

This seems to be happening no matter which server is acting as the lgoonserer for the client.

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Collapse -

Without seeing what the subs and functions are doing

by neilb@uk In reply to HELP!!! Logon script not ...

It's difficult to comment.

If the global mappings are working and the mappings by group member aren't, it suggests that the IsAMemberOf function is buggy and/or coming back with the wrong answer and the line is being skipped.

Neil :)

Collapse -

Begining of logon script

by 1bn0 In reply to Without seeing what the s ...

On Error Resume Next
Dim objFSO,objFILE,objShell,objNetwork
set objFSO=CreateObject("Scripting.FileSystemObject")
set objShell=CreateObject("Wscript.Shell")
set objNetwork=CreateObject("Wscript.Network")

the rest is ust the drive mapping and then the check for the anti-virus.

'additional commands, if any

'End of main script

OOPS! forgot to add

The 6 second delay is the only part I added recently.

I was getting error messages wherer it seemed the machine was trying to map existing drive letters before they were deleted. So I added a small delay to allow the net use delete command to complete.

Two symptoms.

Group membership drives do not map.

P: drive does not map from profile settings.

This is not making much sense to me. i know I must be missing something.

Collapse -

Couple of minor tweaks

by IC-IT In reply to Begining of logon script

After each of the checks for group membership, add an

end if
'Map network drives
MapIt "G:","\\server1\shared"

If IsAMemberOf(objNetwork.UserDomain,objNetwork.UserName,"Accounting") Then MapIt "I:","\\server1\ACCT"

MapIt "Q:","\\server\apps"

end if

If IsAMemberOf(objNetwork.UserDomain,objNetwork.UserName,"Managers") Then MapIt "R:","\\server1\SmartBoard"

end if

You may be getting the "profile's" Home folder mapping, but then loose it when the logon script runs (your script just deleted it).
You could add it to the mapping script.

If IsAMemberOf(objNetwork.UserDomain,objNetwork.UserName,"Domain Users") Then
MapIt "H:","\\FileServer4\Home\" & objNetwork.Username
edited to add one more end if needed here

Collapse -

BWilmot has it correct about the home drives

by neilb@uk In reply to Without seeing what the s ...

What you need to do is run a separate line to clear the mappings for each drive letter EXCEPT the home drive.

I'm still suspicious of the IsAMemberOf function. This will probably be at the end of the script and isn't a straightforward vbscript command.

Collapse -

Thanks for the input.

by 1bn0 In reply to Without seeing what the s ...

I had considered separate net use /delete commands. I am trying not to clutter things up too much.

The lines I used were suggested in a different forum.

I also found a another statement that the profile mapping of the personal drive is a holdover from NT and that the logon script IS a better place to do it.

Can't validate that opinion but it does eliminate the conflict between the profile mapping and the logon script delete command.

I have come to the opinion that this is only an issue because so many users manually map drive letters and check "reconnect" (make persistent) because WIndows can't seem to reliably maintain drive mappings. They keep losing their drive mappings and re-instate them locally.

Collapse -

Logon script - Drive mapping

by ajithrajendran In reply to HELP!!! Logon script not ...

Have you enabled any Software Restriction Policies in the OU in which the user belongs to ?? If yes, you have to create a new Path Rule in the software restriction policy to allow access to the location where the scripts have been stored in the DC or network share or whatever. try this..

Related Discussions

Related Forums