I have used your script for setting proxy's which worked perfectly and it was to my enjoyment as i stated earlier. now am a fun of your scripts and i got this one for mapping drives and printers and i edited it to suit my needs - that is to map drives to certain users who belong to specific groups. like i said i've never worked with scripts before and its giving me an error on line 1 character 1 the error being "type mismatch:'script'". i have pasted my code you can check it out.
[script]
ON ERROR RESUME NEXT
Dim WSHShell, WSHNetwork, objDomain, DomainString, UserString, 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)
'Synchronizes the time with Server our NTP Server
WSHShell.Run "NET TIME \\Server01 /set /y"
'Disconnect ALL mapped drives
Set clDrives = WshNetwork.EnumNetworkDrives
For i = 0 to clDrives.Count -1 Step 2
WSHNetwork.RemoveNetworkDrive clDrives.Item(i),True, True
Next
'Give the PC time to do the disconnect, wait 300 milliseconds
wscript.sleep 300
'Map drives needed by all
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
[/script]
[script]
ON ERROR RESUME NEXT
Dim WSHShell, WSHNetwork, objDomain, DomainString, UserString, 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)
'Synchronizes the time with Server our NTP Server
WSHShell.Run "NET TIME \\Server01 /set /y"
'Disconnect ALL mapped drives
Set clDrives = WshNetwork.EnumNetworkDrives
For i = 0 to clDrives.Count -1 Step 2
WSHNetwork.RemoveNetworkDrive clDrives.Item(i),True, True
Next
'Give the PC time to do the disconnect, wait 300 milliseconds
wscript.sleep 300
'Map drives needed by all
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
[/script]