Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Map Drives Based On Security Group

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,64171
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Map Drives Based On Security Group
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Map Drives Based On Security Group - 9/10/2008 4:01:00 AM   
  fraunkd

 

Posts: 1
Score: 0
Joined: 9/10/2008
Status: offline
I need help editing a VBS logon script.  My knowledge of VB scripting is below what most would consider a beginner.  I created the logon script below based on examples I found on the web.  Thank you for taking a look at my issue, any assistance would be greatly appreciated.

Needed Changes:

I need for the drive mappings for Q and R to be based on AD security group name.  I'd like to keep this as simple as possible  no need for anything fancy.

Also:

If any of the drives are currently mapped, I'd like for the script to skip the drive and move on to the next without throwing an error.  I do not want the script to disconnect a drive and remap and I do not want to display any message boxes.

Current Script:

'---------------------------------------------------
'Skip drive if already in use.  Do not throw errors.
'-------------------------
--------------------------

On Error Resume Next

'-------------------------
--------------------------
'Map drive based on user logon name.
'-------------------------
--------------------------

strDriveLetter = "H:"
strRemotePath = "\\Server1\users"

Set objNetwork = WScript.CreateObject("WScr
ipt.Network")

strUserName = objNetwork.UserName
objNetwork.MapNetworkDrive
strDriveLetter, strRemotePath _
& "\" & strUserName

'-------------------------
--------------------------
'Map network drives for everyone (need to edit Q and R
'mappings to be based on security group membership).
'-------------------------
--------------------------

strDriveLetter1 = "I:"
strDriveLetter2 = "K:"
strDriveLetter3 = "Q:"
strDriveLetter4 = "R:"

strRemotePath1 = "\\Server1\shared"
strRemotePath2 = "\\Server1\general"
strRemotePath3 = "\\Server1\payroll"
strRemotePath4 = "\\Server1\marketing"

Set objNetwork = CreateObject("WScript.Netw
ork")

objNetwork.MapNetworkDrive
strDriveLetter1, strRemotePath1
objNetwork.MapNetworkDrive
strDriveLetter2, strRemotePath2
objNetwork.MapNetworkDrive
strDriveLetter3, strRemotePath3
objNetwork.MapNetworkDrive
strDriveLetter4, strRemotePath4

WScript.Quit


When looking at other examples on the net I see "if IsAMemberof" used alot but these examples never seem to work properly when incorporated into my script.  Apparently I am not adding it properly as I usually receive "Error: Type mismatch: 'IsAMemberOf'".  

Example:

If IsAMemberOf(objNetwork.UserDomain,objNetwork.UserName,"Domain Users") Then MapIt "I:","\\Server1\shared"

Again, any help on this is greatly appreciated.
 
 
Post #: 1
 
 RE: Map Drives Based On Security Group - 9/10/2008 6:42:05 PM   
  ginolard


Posts: 1062
Score: 21
Joined: 8/10/2005
Status: offline
Take a look at this

http://www.visualbasicscript.com/m_52191/mpage_1/key_mapped/tm.htm#52191

It's what I use in our login script here and works very well and is easily extendable.

_____________________________

Author of ManagePC - http://managepc.net
AD Query Template - http://www.visualbasicscript.com/m_40609/tm.htm
Consolidated Scripting Framework - http://www.visualbasicscript.com/m_59109/tm.htm

(in reply to fraunkd)
 
 
Post #: 2
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Map Drives Based On Security Group Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts