[gptalk] Re: Vbs logon script for mapped drives - one group having problems

  • From: <Booker.Washington@xxxxxxxxxxxxxx>
  • To: <gptalk@xxxxxxxxxxxxx>
  • Date: Mon, 17 Nov 2008 10:36:45 -0500

Thanks, ok, So I have the script below, and regarding the groups below, my 
account is only a part of MGT IT Services Group, but somehow I got the O drive, 
when I should have only had the Y drive.....I can't see how I got the O drive, 
at all!!

On Error Resume Next

Set objSysInfo = CreateObject("ADSystemInfo")
Set objNetwork = CreateObject("Wscript.Network")

strUserPath = "LDAP://" & objSysInfo.UserName
Set objUser = GetObject(strUserPath)

'Removes curent mappings
objNetwork.RemoveNetworkDrive "L:", True, True
objNetwork.RemoveNetworkDrive "J:", True, True
objNetwork.RemoveNetworkDrive "Z:", True, True
objNetwork.RemoveNetworkDrive "R:", True, True
objNetwork.RemoveNetworkDrive "N:", True, True
objNetwork.RemoveNetworkDrive "O:", True, True
objNetwork.RemoveNetworkDrive "U:", True, True
objNetwork.RemoveNetworkDrive "S:", True, True
objNetwork.RemoveNetworkDrive "M:", True, True
objNetwork.RemoveNetworkDrive "I:", True, True
objNetwork.RemoveNetworkDrive "K:", True, True
objNetwork.RemoveNetworkDrive "Z:", True, True
objNetwork.RemoveNetworkDrive "X:", True, True
objNetwork.RemoveNetworkDrive "Y:", True, True
objNetwork.RemoveNetworkDrive "Q:", True, True

'Finds users group membership
'For Each strGroup in objUser.MemberOf
'strGroupPath = "LDAP://" & strGroup
'Set objGroup = GetObject(strGroupPath)
'strGroupName = objGroup.CN

If (IsMember(objUser, "MGT IT Services Group") = True) Then
 objNetwork.MapNetworkDrive "Y:", 
"\\fileserver01.tgm.domain.com\com\shares\groups\IT services", False
End If


If (IsMember(objUser, "MGT Career Services") = True) Then
 objNetwork.MapNetworkDrive "L:", 
"\\fileserver01.tgm.domain.com\com\shares\groups\Career Services", False
objNetwork.MapNetworkDrive "J:", 
"\\fileserver01.tgm.domain.com\com\shares\groups\Career Svcs_Act", False
objNetwork.MapNetworkDrive "Z:", 
"\\fileserver01.tgm.domain.com\com\shares\groups\Undergraduate Office", False
End If

If (IsMember(objUser, "MGT Career Services SAs") = True) Then
 objNetwork.MapNetworkDrive "L:", 
"\\fileserver01.tgm.domain.com\com\shares\groups\Career Services", False
objNetwork.MapNetworkDrive "J:", 
"\\fileserver01.tgm.domain.com\com\shares\groups\Career Svcs_Act", False
objNetwork.MapNetworkDrive "Z:", 
"\\fileserver01.tgm.domain.com\com\shares\groups\Undergraduate Office", False
End If

If (IsMember(objUser, "MGT CIBER") = True) Then
 objNetwork.MapNetworkDrive "R:", 
"\\fileserver01.tgm.domain.com\com\shares\groups\CIBER", False
End If

If (IsMember(objUser, "MGT Communications") = True) Then
 objNetwork.MapNetworkDrive "R:", 
"\\fileserver01.tgm.domain.com\com\shares\groups\Communications", False
objNetwork.MapNetworkDrive "N:", 
"\\fileserver01.tgm.domain.com\com\shares\groups\DeanSuite", False
End If

If (IsMember(objUser, "MGT Communications Share Guest access") = True) Then
 objNetwork.MapNetworkDrive "R:", 
"\\fileserver01.tgm.domain.com\com\shares\groups\Communications", False
objNetwork.MapNetworkDrive "N:", 
"\\fileserver01.tgm.domain.com\com\shares\groups\DeanSuite", False
End If

If (IsMember(objUser, "MGT Dean Suite non HR") = True) Then
 objNetwork.MapNetworkDrive "L:", 
"\\fileserver01.tgm.domain.com\com\shares\groups\Building Operations", False
objNetwork.MapNetworkDrive "N:", 
"\\fileserver01.tgm.domain.com\com\shares\groups\DeanSuite", False
objNetwork.MapNetworkDrive "O:", 
"\\fileserver01.tgm.domain.com\com\shares\groups\Accounting", False
objNetwork.MapNetworkDrive "U:", 
"\\fileserver01.tgm.domain.com\com\shares\groups\Graduate Assistantship", False
objNetwork.MapNetworkDrive "S:", 
"\\fileserver01.tgm.domain.com\com\shares\groups\Accounting\FAcS", False
End If

If (IsMember(objUser, "MGT Development") = True) Then
 objNetwork.MapNetworkDrive "L:", 
"\\fileserver01.tgm.domain.com\com\shares\groups\Development", False
 objNetwork.MapNetworkDrive "R:", 
"\\fileserver01.tgm.domain.com\com\shares\groups\Communications", False
 objNetwork.MapNetworkDrive "M:", 
"\\fileserver01.tgm.domain.com\com\shares\groups\Development\Student Share", 
False
 objNetwork.MapNetworkDrive "N:", 
"\\fileserver01.tgm.domain.com\com\shares\groups\DeanSuite", False
End If

If (IsMember(objUser, "MGT Development SAs") = True) Then
 objNetwork.MapNetworkDrive "M:", 
"\\fileserver01.tgm.domain.com\com\shares\groups\Development\Student Share", 
False
End If

If (IsMember(objUser, "MGT Eview Users") = True) Then
 objNetwork.MapNetworkDrive "Y:", 
"\\fileserver01.tgm.domain.com\com\shares\groups\eview", False
End If

If (IsMember(objUser, "MGT Executive Masters") = True) Then
 objNetwork.MapNetworkDrive "I:", 
"\\fileserver01.tgm.domain.com\com\shares\groups\Executive Education", False
objNetwork.MapNetworkDrive "J:", 
"\\fileserver01.tgm.domain.com\com\shares\groups\EMSMOT_Act", False
objNetwork.MapNetworkDrive "K:", 
"\\fileserver01.tgm.domain.com\com\shares\groups\EMSMOT", False
objNetwork.MapNetworkDrive "O:", 
"\\fileserver01.tgm.domain.com\com\shares\groups\Accounting", False
objNetwork.MapNetworkDrive "L:", 
"\\fileserver01.tgm.domain.com\com\shares\groups\Executive Programs", False
End If

If (IsMember(objUser, "MGT Executive Programs") = True) Then
 objNetwork.MapNetworkDrive "I:", 
"\\fileserver01.tgm.domain.com\com\shares\groups\Executive Education", False
objNetwork.MapNetworkDrive "J:", 
"\\fileserver01.tgm.domain.com\com\shares\groups\EMSMOT_Act", False
objNetwork.MapNetworkDrive "K:", 
"\\fileserver01.tgm.domain.com\com\shares\groups\EMSMOT", False
objNetwork.MapNetworkDrive "O:", 
"\\fileserver01.tgm.domain.com\com\shares\groups\Accounting", False
objNetwork.MapNetworkDrive "L:", 
"\\fileserver01.tgm.domain.com\com\shares\groups\Executive Programs", False
End If

If (IsMember(objUser, "MGT Explab Share participants") = True) Then
 objNetwork.MapNetworkDrive "Z:", 
"\\fileserver01.tgm.domain.com\com\shares\groups\Explab", False
End If

If (IsMember(objUser, "MGT Graduate Office") = True) Then
 objNetwork.MapNetworkDrive "M:", 
"\\fileserver01.tgm.domain.com\com\shares\groups\Graduate Office", False
End If

If (IsMember(objUser, "MGT Grad Assistant Share") = True) Then
 objNetwork.MapNetworkDrive "U:", 
"\\fileserver01.tgm.domain.com\com\shares\groups\Graduate Assistantship", False
End If

If (IsMember(objUser, "MGT HR staff") = True) Then
 objNetwork.MapNetworkDrive "X:", 
"\\fileserver01.tgm.domain.com\com\shares\groups\Building Operations", False
objNetwork.MapNetworkDrive "N:", 
"\\fileserver01.tgm.domain.com\com\shares\groups\DeanSuite", False
objNetwork.MapNetworkDrive "O:", 
"\\fileserver01.tgm.domain.com\com\shares\groups\Accounting", False
objNetwork.MapNetworkDrive "Y:", 
"\\fileserver01.tgm.domain.com\com\shares\groups\Communications", False
objNetwork.MapNetworkDrive "R:", 
"\\fileserver01.tgm.domain.com\com\shares\groups\Human Resources", False
objNetwork.MapNetworkDrive "Q:", 
"\\fileserver01.tgm.domain.com\com\shares\groups\Accounting\Pcard", False
End If

If (IsMember(objUser, "ILE Office") = True) Then
 objNetwork.MapNetworkDrive "J:", 
"\\fileserver01.tgm.domain.com\com\shares\groups\Institute for LE", False
End If

If (IsMember(objUser, "ILE GRAs") = True) Then
 objNetwork.MapNetworkDrive "J:", 
"\\fileserver01.tgm.domain.com\com\shares\groups\Institute for LE", False
End If

If (IsMember(objUser, "MGT Tiger Share participants") = True) Then
 objNetwork.MapNetworkDrive "R:", 
"\\fileserver01.tgm.domain.com\com\shares\groups\Tiger", False
End If

If (IsMember(objUser, "MGT Undergraduate Office") = True) Then
 objNetwork.MapNetworkDrive "M:", 
"\\fileserver01.tgm.domain.com\com\shares\groups\Undergraduate Office", False
End If

If (IsMember(objUser, "MGT Recruiting Share Access") = True) Then
 objNetwork.MapNetworkDrive "Q:", 
"\\fileserver01.tgm.domain.com\com\shares\groups\Recruiting", False
End If

If (IsMember(objUser, "MGT Faculty") = True) Then
 objNetwork.MapNetworkDrive "S:", 
"\\fileserver01.tgm.domain.com\com\shares\groups\Accounting\FAcS", False
End If





Booker T. Washington III
Systems Support Specialist
From: gptalk-bounce@xxxxxxxxxxxxx [mailto:gptalk-bounce@xxxxxxxxxxxxx] On 
Behalf Of Jeremy Saunders
Sent: Friday, November 14, 2008 7:10 PM
To: gptalk@xxxxxxxxxxxxx
Subject: [gptalk] Re: Vbs logon script for mapped drives - one group having 
problems

This optional component controls whether the new mapped network drive should be 
stored in the user's profile. It's a Boolean argument that takes either true or 
false.  The default is false, so the only time you need to enter a value is if 
you positively want the user to receive this drive every time they logon, in 
which case you set it to true.

If comparing it to the "NET USE" command line, it's the same concept as the 
/PERSISTENT:{YES | NO}

Cheers,
Jeremy.

From: gptalk-bounce@xxxxxxxxxxxxx [mailto:gptalk-bounce@xxxxxxxxxxxxx] On 
Behalf Of Booker.Washington@xxxxxxxxxxxxxx
Sent: Saturday, November 15, 2008 7:40 AM
To: gptalk@xxxxxxxxxxxxx
Subject: [gptalk] Re: Vbs logon script for mapped drives - one group having 
problems

David, what function does the , False perform in this snippet of your code

Booker T. Washington III
Systems Support Specialist

From: gptalk-bounce@xxxxxxxxxxxxx [mailto:gptalk-bounce@xxxxxxxxxxxxx] On 
Behalf Of David Palombi
Sent: Thursday, November 06, 2008 4:18 PM
To: gptalk@xxxxxxxxxxxxx
Subject: [gptalk] Re: Vbs logon script for mapped drives - one group having 
problems

This is what we have for our login script.  This is just a snippet of the code.

If (IsMember(objUser, "PERFORMANCE") = True) Then
 objNetwork.MapNetworkDrive "v:", 
"\\bluewater\performance$<file:///\\bluewater\performance$>", False
End If

David Palombi
----- Original Message -----
From: Booker.Washington@xxxxxxxxxxxxxx<mailto:Booker.Washington@xxxxxxxxxxxxxx>
To: gptalk@xxxxxxxxxxxxx<mailto:gptalk@xxxxxxxxxxxxx>
Sent: Thursday, November 06, 2008 4:07 PM
Subject: [gptalk] Vbs logon script for mapped drives - one group having problems

I have the following vbs script below.  The script maps drives based on the 
users group membership

For some members of the group MGT Undergraduate Office, they report that 
"sometimes" when they login the drive will not map, but if they restart, then 
the drive shows.  Obviously, that is not ideal, so I am trying to figure out 
where to start troubleshooting to see why this is occurring.

So far in my testing, I have not heard complaints from the one other group that 
is a part of my test roll out of this logon script

On Error Resume Next

Set objSysInfo = CreateObject("ADSystemInfo")
Set objNetwork = CreateObject("Wscript.Network")

strUserPath = "LDAP://" & objSysInfo.UserName
Set objUser = GetObject(strUserPath)

'Removes curent mappings
objNetwork.RemoveNetworkDrive "L:", True, True
objNetwork.RemoveNetworkDrive "J:", True, True
objNetwork.RemoveNetworkDrive "Z:", True, True
objNetwork.RemoveNetworkDrive "R:", True, True
objNetwork.RemoveNetworkDrive "N:", True, True
objNetwork.RemoveNetworkDrive "O:", True, True
objNetwork.RemoveNetworkDrive "U:", True, True
objNetwork.RemoveNetworkDrive "S:", True, True
objNetwork.RemoveNetworkDrive "M:", True, True
objNetwork.RemoveNetworkDrive "I:", True, True
objNetwork.RemoveNetworkDrive "K:", True, True
objNetwork.RemoveNetworkDrive "Z:", True, True
objNetwork.RemoveNetworkDrive "X:", True, True
objNetwork.RemoveNetworkDrive "Y:", True, True
objNetwork.RemoveNetworkDrive "Q:", True, True

'Finds users group membership
For Each strGroup in objUser.MemberOf
strGroupPath = "LDAP://" & strGroup
Set objGroup = GetObject(strGroupPath)
strGroupName = objGroup.CN


'Mappings for all users
'objNetwork.MapNetworkDrive "T:", 
"\\nas1.prism.myschool.com\com\profiles\%username%\My Documents"
'wscript.Echo strUser.userName


'Mappings Based on Group Membership
'wscript.Echo objGroup.CN
Select Case strGroupName

Case "MGT IT Services Group"
objNetwork.MapNetworkDrive "Y:", 
"\\mgt-fileshare.mgt.myschool.com\com\shares\groups\IT services"

'Case "MGT Accounting"
'objNetwork.MapNetworkDrive "R:", 
"\\mgt-fileshare.mgt.myschool.com\com\shares\groups\Accounting"

Case "MGT Career Services"
objNetwork.MapNetworkDrive "L:", 
"\\mgt-fileshare.mgt.myschool.com\com\shares\groups\Career Services"
objNetwork.MapNetworkDrive "j:", 
"\\mgt-fileshare.mgt.myschool.com\com\shares\groups\Career Svcs_Act"
objNetwork.MapNetworkDrive "z:", 
"\\mgt-fileshare.mgt.myschool.com\com\shares\groups\Undergraduate Office"

Case "MGT Career Services SAs"
objNetwork.MapNetworkDrive "L:", 
"\\mgt-fileshare.mgt.myschool.com\com\shares\groups\Career Services"
objNetwork.MapNetworkDrive "j:", 
"\\mgt-fileshare.mgt.myschool.com\com\shares\groups\Career Svcs_Act"
objNetwork.MapNetworkDrive "z:", 
"\\mgt-fileshare.mgt.myschool.com\com\shares\groups\Undergraduate Office"


Case "MGT CIBER"
objNetwork.MapNetworkDrive "R:", 
"\\mgt-fileshare.mgt.myschool.com\com\shares\groups\CIBER"

Case "MGT CIBER GRAs"
objNetwork.MapNetworkDrive "R:", 
"\\mgt-fileshare.mgt.myschool.com\com\shares\groups\CIBER"


Case "MGT Communications"
objNetwork.MapNetworkDrive "R:", 
"\\mgt-fileshare.mgt.myschool.com\com\shares\groups\Communications"
objNetwork.MapNetworkDrive "N:", 
"\\mgt-fileshare.mgt.myschool.com\com\shares\groups\DeanSuite"

Case "MGT Communications Share Guest access"
objNetwork.MapNetworkDrive "R:", 
"\\mgt-fileshare.mgt.myschool.com\com\shares\groups\Communications"
objNetwork.MapNetworkDrive "N:", 
"\\mgt-fileshare.mgt.myschool.com\com\shares\groups\DeanSuite"


Case "MGT Dean Suite non HR"
objNetwork.MapNetworkDrive "L:", 
"\\mgt-fileshare.mgt.myschool.com\com\shares\groups\Building Operations"
objNetwork.MapNetworkDrive "N:", 
"\\mgt-fileshare.mgt.myschool.com\com\shares\groups\DeanSuite"
objNetwork.MapNetworkDrive "O:", 
"\\mgt-fileshare.mgt.myschool.com\com\shares\groups\Accounting"
objNetwork.MapNetworkDrive "U:", 
"\\mgt-fileshare.mgt.myschool.com\com\shares\groups\Graduate Assistantship"
objNetwork.MapNetworkDrive "S:", 
"\\mgt-fileshare.mgt.myschool.com\com\shares\groups\Accounting\FAcS"


'Case "MGT Dean's Suite"
'objNetwork.MapNetworkDrive "T:", 
"\\mgt-fileshare.mgt.myschool.com\com\shares\groups"


Case "MGT Development"
objNetwork.MapNetworkDrive "L:", 
"\\mgt-fileshare.mgt.myschool.com\com\shares\groups\Development"
objNetwork.MapNetworkDrive "R:", 
"\\mgt-fileshare.mgt.myschool.com\com\shares\groups\Communications"
objNetwork.MapNetworkDrive "M:", 
"\\mgt-fileshare.mgt.myschool.com\com\shares\groups\Development\Student Share"
objNetwork.MapNetworkDrive "N:", 
"\\mgt-fileshare.mgt.myschool.com\com\shares\groups\DeanSuite"

Case "MGT Development SAs"
objNetwork.MapNetworkDrive "M:", 
"\\mgt-fileshare.mgt.myschool.com\com\shares\groups\Development\Student Share"

'Case "MGT Event Support"
'objNetwork.MapNetworkDrive "T:", 
"\\mgt-fileshare.mgt.myschool.com\com\shares\groups"


Case "MGT Eview Users"
objNetwork.MapNetworkDrive "T:", 
"\\mgt-fileshare.mgt.myschool.com\com\shares\groups\eview"


Case "MGT Executive Masters"
objNetwork.MapNetworkDrive "I:", 
"\\mgt-fileshare.mgt.myschool.com\com\shares\groups\Executive Education"
objNetwork.MapNetworkDrive "J:", 
"\\mgt-fileshare.mgt.myschool.com\com\shares\groups\EMSMOT_Act"
objNetwork.MapNetworkDrive "K:", 
"\\mgt-fileshare.mgt.myschool.com\com\shares\groups\EMSMOT"
objNetwork.MapNetworkDrive "O:", 
"\\mgt-fileshare.mgt.myschool.com\com\shares\groups\Accounting"
objNetwork.MapNetworkDrive "L:", 
"\\mgt-fileshare.mgt.myschool.com\com\shares\groups\Executive Programs"

Case "MGT Executive Programs"
objNetwork.MapNetworkDrive "I:", 
"\\mgt-fileshare.mgt.myschool.com\com\shares\groups\Executive Education"
objNetwork.MapNetworkDrive "J:", 
"\\mgt-fileshare.mgt.myschool.com\com\shares\groups\EMSMOT_Act"
objNetwork.MapNetworkDrive "K:", 
"\\mgt-fileshare.mgt.myschool.com\com\shares\groups\EMSMOT"
objNetwork.MapNetworkDrive "O:", 
"\\mgt-fileshare.mgt.myschool.com\com\shares\groups\Accounting"
objNetwork.MapNetworkDrive "L:", 
"\\mgt-fileshare.mgt.myschool.com\com\shares\groups\Executive Programs"

Case "MGT Explab Share participants"
'objNetwork.MapNetworkDrive "L:", 
"\\mgt-fileshare.mgt.myschool.com\com\shares\groups\Explab"
objNetwork.MapNetworkDrive "Z:", 
"\\mgt-fileshare.mgt.myschool.com\com\shares\groups\ExpLab"


'Case "MGT FACS Admin Assistant List F access"
'objNetwork.MapNetworkDrive "T:", 
"\\mgt-fileshare.mgt.myschool.com\com\shares\groups"


'Case "MGT FACS Admin Assistant read access"
'objNetwork.MapNetworkDrive "T:", 
"\\mgt-fileshare.mgt.myschool.com\com\shares\groups"


'Case "MGT FACS Admin Assistant read write access"
'objNetwork.MapNetworkDrive "T:", 
"\\mgt-fileshare.mgt.myschool.com\com\shares\groups"


'Case "MGT Faculty"
'objNetwork.MapNetworkDrive "T:", 
"\\mgt-fileshare.mgt.myschool.com\com\shares\groups"

'Case "MGT Staff FaCs access"
'objNetwork.MapNetworkDrive "T:", 
"\\mgt-fileshare.mgt.myschool.com\com\shares\groups"



Case "MGT Graduate Office"
objNetwork.MapNetworkDrive "M:", 
"\\mgt-fileshare.mgt.myschool.com\com\shares\groups\Graduate Office"

Case "MGT Grad Assistant Share"
objNetwork.MapNetworkDrive "U:", 
"\\mgt-fileshare.mgt.myschool.com\com\shares\groups\Graduate Assistantship"

Case "MGT HR staff"
objNetwork.MapNetworkDrive "X:", 
"\\mgt-fileshare.mgt.myschool.com\com\shares\groups\Building Operations"
objNetwork.MapNetworkDrive "N:", 
"\\mgt-fileshare.mgt.myschool.com\com\shares\groups\DeanSuite"
objNetwork.MapNetworkDrive "O:", 
"\\mgt-fileshare.mgt.myschool.com\com\shares\groups\Accounting"
objNetwork.MapNetworkDrive "Y:", 
"\\mgt-fileshare.mgt.myschool.com\com\shares\groups\Communications"
objNetwork.MapNetworkDrive "R:", 
"\\mgt-fileshare.mgt.myschool.com\com\shares\groups\Human Resources"
objNetwork.MapNetworkDrive "Q:", 
"\\mgt-fileshare.mgt.myschool.com\com\shares\groups\Accounting\Pcard"


Case "ILE Office"
objNetwork.MapNetworkDrive "J:", 
"\\mgt-fileshare.mgt.myschool.com\com\shares\groups\Institute for LE"

Case "ILE GRAs"
objNetwork.MapNetworkDrive "J:", 
"\\mgt-fileshare.mgt.myschool.com\com\shares\groups\Institute for LE"

Case "MGT Tiger Share participants"
objNetwork.MapNetworkDrive "T:", 
"\\mgt-fileshare.mgt.myschool.com\com\shares\groups\Tiger"


Case "MGT Undergraduate Office"
objNetwork.MapNetworkDrive "M:", 
"\\mgt-fileshare.mgt.myschool.com\com\shares\groups\Undergraduate Office"


Case "MGT Recruiting Share Access"
objNetwork.MapNetworkDrive "Q:", 
"\\mgt-fileshare.mgt.myschool.com\com\shares\groups\Recruiting"

Case "MGT Faculty"
objNetwork.MapNetworkDrive "S:", 
"\\mgt-fileshare.mgt.myschool.com\com\shares\groups\Accounting\FAcS"



End Select
Next

Booker T. Washington III
Systems Support Specialist
________________________________
Confidentiality and Privilege Notice
This document is intended solely for the named addressee.  The information 
contained in the pages is confidential and contains legally privileged 
information. If you are not the addressee indicated in this message (or 
responsible for delivery of the message to such person), you may not copy or 
deliver this message to anyone, and you should destroy this message and kindly 
notify the sender by reply email. Confidentiality and legal privilege are not 
waived or lost by reason of mistaken delivery to you.
________________________________

Other related posts: