| |
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("WScript.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.Network") 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.
|
|