I have edited the script below to meet my user needs. its for a small college and all students belong to a group called students for easy administration. Now these students also belong to other seperate groups apart from the students group depending on the courses they are taking e.g information technology, library studies etc. now when a user logs in he can view his home folder located on the path \\server01\students home$\%username% - drive G:, the students common folder on the path \\server01\users$\students folder - drive H:, but the drive I: which i have created for them depending on the groups there in (that is course) is not mapping. Is there an error on my script. help me out
ON ERROR RESUME NEXT
Dim WSHShell, WSHNetwork, objDomain, DomainString, UserString, Groupobj, UserObj, Path
Set WSHShell = CreateObject("WScript.Shell")
Set WSHNetwork = CreateObject("WScript.Network")
Set objDomain = getObject("LDAP://rootDse")
DomainString = objDomain.Get("dnsHostName")
UserString = WSHNetwork.UserName
'Bind to the user object to get user name and check for group memberships later
Set UserObj = GetObject("WinNT://" & DomainString & "/" & UserString)
'Map drives needed by all
WSHNetwork.MapNetworkDrive "G:", "\\server01\students home$\%username%",True
WSHNetwork.MapNetworkDrive "H:", "\\server01\users$\Students Folder",True
'Now check for group memberships and map appropriate drives
For Each GroupObj In UserObj.Groups
Select Case GroupObj.Name
'Check for group memberships and take needed action
Case "InformationTechnology"
WSHNetwork.MapNetworkDrive "I:", "\\Server01\users$\Information Technology",True
Case "BusinessStudies"
WSHNetwork.MapNetworkDrive "I:", "\\Server01\users$\Business Studies",True
Case "LibraryStudies"
WSHNetwork.MapNetworkDrive "I:", "\\Server01\users$\Library Studies",True
Case "SecretarialStudies"
WSHNetwork.MapNetworkDrive "I:", "\\Server01\users$\Secretarial Studies",True
End Select
NEXT
'Clean Up Memory We Used
set UserObj = Nothing
set GroupObj = Nothing
set WSHNetwork = Nothing
set DomainString = Nothing
set WSHSHell = Nothing
Set WSHPrinters = Nothing
'Quit the Script
wscript.quit
ON ERROR RESUME NEXT
Dim WSHShell, WSHNetwork, objDomain, DomainString, UserString, Groupobj, UserObj, Path
Set WSHShell = CreateObject("WScript.Shell")
Set WSHNetwork = CreateObject("WScript.Network")
Set objDomain = getObject("LDAP://rootDse")
DomainString = objDomain.Get("dnsHostName")
UserString = WSHNetwork.UserName
'Bind to the user object to get user name and check for group memberships later
Set UserObj = GetObject("WinNT://" & DomainString & "/" & UserString)
'Map drives needed by all
WSHNetwork.MapNetworkDrive "G:", "\\server01\students home$\%username%",True
WSHNetwork.MapNetworkDrive "H:", "\\server01\users$\Students Folder",True
'Now check for group memberships and map appropriate drives
For Each GroupObj In UserObj.Groups
Select Case GroupObj.Name
'Check for group memberships and take needed action
Case "InformationTechnology"
WSHNetwork.MapNetworkDrive "I:", "\\Server01\users$\Information Technology",True
Case "BusinessStudies"
WSHNetwork.MapNetworkDrive "I:", "\\Server01\users$\Business Studies",True
Case "LibraryStudies"
WSHNetwork.MapNetworkDrive "I:", "\\Server01\users$\Library Studies",True
Case "SecretarialStudies"
WSHNetwork.MapNetworkDrive "I:", "\\Server01\users$\Secretarial Studies",True
End Select
NEXT
'Clean Up Memory We Used
set UserObj = Nothing
set GroupObj = Nothing
set WSHNetwork = Nothing
set DomainString = Nothing
set WSHSHell = Nothing
Set WSHPrinters = Nothing
'Quit the Script
wscript.quit