Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help Needed --> Logon Script

Status
Not open for further replies.

Rubymoon

IS-IT--Management
Jul 7, 2008
13
CA
I have this script, which was, to my knowledge mapping drives correctly on Friday, and now it is not working. It maps my general drives but not the drives for the group users. If someone could help i would be more than grateful, it is a big issue today >.<

Here is the script
_______________________________________________________

**********************************************************************************
' ********************************* SCRIPT START **********************************

On Error Resume Next

Dim objNetwork, objUser, CurrentUser
Dim strGroup
Dim objFSO, objFILE, objShell

Const Administrators = "cn=administrators"
Const Gymcode = "cn=gymcode"
Const Waseya_House = "cn=waseya"
Const Medical_Report = "cn=mreport"
Const Inventory = "cn=inventory"
Const IFormula = "cn=iformula"
Const Vaxin = "cn=vaxin"

Set objNetwork = CreateObject("WScript.Network")
Set objUser = CreateObject("ADSystemInfo")
Set CurrentUser = GetObject("LDAP://" & objUser.UserName)
set objFSO=CreateObject("Scripting.FileSystemObject")
set objShell=CreateObject("Wscript.Shell")

strWelcomeMsg="Welcome to the Health Centre secure network."
strHelpMsg="Contact the technician for further assistance."
iErrorTimeout=10
blnShowError=True

If isarray(CurrentUser.Memberof) then
strgroup = LCase(Join(CurrentUser.memberof))
Else
strgroup = LCase(CurrentUser.Memberof)
End If

' ******************************** GENERAL MAPPING ********************************

objNetwork.MapNetworkDrive "P:", "\\server\public"
objNetwork.MapNetworkDrive "X:", "\\server\" & objNetwork.UserName & "$"
objNetwork.MapNetworkDrive "I:", "\\server\installer$"

' **************************** GROUP MEMBERSHIP MAPPING ****************************

If InStr(strGroup, Administrators) Then
objNetwork.MapNetworkDrive "W:", "\\server\adm$"
End If

' **********************************************************************************

If InStr(strGroup, Gymcode) Then
objNetwork.MapNetworkDrive "V:", "\\server\gymcode$"
End If

' **********************************************************************************

If InStr(strGroup, Waseya_House) Then
objNetwork.MapNetworkDrive "S:", "\\server\waseya$"
End If

' **********************************************************************************

If InStr(strGroup, Medical_Report) Then
objNetwork.MapNetworkDrive "R:", "\\server\mreport$"
End If

' **********************************************************************************

If InStr(strGroup, Inventory) Then
objNetwork.MapNetworkDrive "T:", "\\server\inventory$"
End If

' **********************************************************************************

If InStr(strGroup, IFormula) Then
objNetwork.MapNetworkDrive "U:", "\\server\iformula$"
End If

' **********************************************************************************

If InStr(strGroup, Vaxin) Then
objNetwork.MapNetworkDrive "Q:", "\\server\apps"
End If

' ******************************** SUMMARY MESSAGE ********************************

iDisplayTimeout=8
strMsg=""
strMsg=strMsg & strWelcomeMsg & VbCrLf
strMsg=strMsg & vbcrlf
strMsg=strMsg & vbcrlf

Set objDrives = objNetwork.EnumNetworkDrives
strMsg=strMsg & "Network drive mappings:" & vbcrlf
For i = 0 to objDrives.Count - 1 Step 2
strMsg=strMsg & "Drive " & objDrives.Item(i) & "=" & objDrives.Item(i+1) & vbcrlf
Next
strMsg=strMsg & vbcrlf

If strMsg<>"" Then objShell.Popup strMsg,iDisplayTimeout,"Network Drive Summary",vbOKOnly+vbInformation


' **********************************************************************************

wscript.end
 
If you still haven't figured this one out....start with removing the "On Error Resume Next" and see what error you get and let us know.

--------------------------------------------------------------------------------
dm4ever
My philosophy: K.I.S.S - Keep It Simple Stupid
 
Oh yuk! Move your group mappings to a select case statement. Refer to my FAQ on the subject for sample code.

faq329-5798

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top