'This works well for a small amount of users, AS A LOGIN SCRIPT.
Option Explicit
Dim WshNetwork, WshShell, colDrives, objNetwork, clPrinters
Dim strUserDomain, sComputerName, sUserName, iCount
Set WshNetwork = CreateObject("WScript.Network")
set WshShell = createobject("WScript.Shell")
Set colDrives = WshNetwork.EnumNetworkDrives
Set objNetwork = WScript.CreateObject("WScript.Network")
On Error Resume Next
'Make sure user & computer name is tested in Upper Case
strUserDomain = objNetwork.UserDomain
sComputerName = UCase(WshNetwork.ComputerName)
sUserName = UCase(WshNetwork.Username)
IF strUserDomain = "DEVELOPMENT" Then
'Clear all user mapped drives on shares
For iCount = 0 to colDrives.Count-1 Step 2
WshNetwork.RemoveNetworkDrive colDrives.Item(iCount)
Next
iF sComputerName <> "SERVER" Then
WshNetwork.MapNetworkDrive "H:", "\\assoftsvr\home\"
& sUserName,false
WshShell.Run "net time /rtsdomain:development /set
/yes",0,true
WshShell.Run "net use X: \\assoftsvr\CDRom",0,true
'WshShell.SendKeys "{NUMLOCK}"
Select case sUserName
Case "USER1"
WshNetwork.MapNetworkDrive "L:",
"\\assoftsvr\alltasks",false
WshNetwork.MapNetworkDrive "M:",
"\\assoftsvr\clientscode",false
WshNetwork.MapNetworkDrive "N:",
"\\assoftsvr\personal",false
WshNetwork.MapNetworkDrive "O:",
"\\assoftsvr\documents",false
WshNetwork.MapNetworkDrive "P:",
"\\assoftsvr\applications",false
WshNetwork.AddPrinterConnection "LPT1:",
"\\assoftsvr\LexOptra.0"
WshNetwork.AddPrinterConnection "LPT2:",
"\\assoftsvr\LexOptra.1"
WshNetwork.AddPrinterConnection "LPT3:",
"\\assoftsvr\LexOptra.2"
WshNetwork.SetDefaultPrinter
"\\assoftsvr\LexOptra.0"
WshShell.Run "XCOPY \\assoftsvr\Vet\*.da? c:\vet
/C/D/Q/R/Y",0,true
Case "USER2"
WshNetwork.MapNetworkDrive "L:",
"\\assoftsvr\alltasks",false
WshNetwork.MapNetworkDrive "M:",
"\\assoftsvr\clientscode",false
WshNetwork.MapNetworkDrive "N:",
"\\assoftsvr\personal",false
WshNetwork.MapNetworkDrive "O:",
"\\assoftsvr\documents",false
WshNetwork.MapNetworkDrive "P:",
"\\assoftsvr\applications",false
WshNetwork.AddPrinterConnection "LPT1:",
"\\assoftsvr\LexOptra.0"
WshNetwork.SetDefaultPrinter
"\\assoftsvr\LexOptra.0"
Case "USER3"
WshNetwork.MapNetworkDrive "O:",
"\\assoftsvr\documents",false
WshNetwork.AddPrinterConnection "LPT1:",
"\\assoftsvr\LexOptra.0"
WshNetwork.SetDefaultPrinter
"\\assoftsvr\LexOptra.0"
WshShell.Run "XCOPY \\assoftsvr\Vet\*.da? c:\vet
/C/D/Q/R/Y",0,true
Case "USER4"
WshNetwork.MapNetworkDrive "O:",
"\\assoftsvr\documents",false
WshNetwork.AddPrinterConnection "LPT1:",
"\\assoftsvr\LexOptra.0"
WshNetwork.SetDefaultPrinter
"\\assoftsvr\LexOptra.0"
WshShell.Run "XCOPY \\assoftsvr\Vet\*.da? c:\vet
/C/D/Q/R/Y",0,true
End Select
Elseif WshNetwork.ComputerName = "ASSOFTSVR" Then
WshNetwork.MapNetworkDrive "O:",
"\\assoftsvr\documents",false
End If
'Set fso = CreateObject("Scripting.FileSystemObject")
'Set a = fso.GetFile("\\Assoftsvr\Documents\My
Pictures\wallpaper\" & weekday(date) & ".jpg")
'a.Copy ("c:\files\newtest.jpg")
'Wscript.Echo "System Configuration Complete"
'Wscript.Echo "user: " & sUserName
'Wscript.Echo "Computer: " & sComputerName
End If
Set WshShell = nothing
Set WshNetwork = nothing
Set colDrives = Nothing
Set objNetwork = Nothing