MartinLove
MIS
Hi, I have spent a good few hours going through the post on this site and trying different thing to get my LogonScript to work, but have been unsucceful..
I have a 2003 SBS as the server, with a mix of W2k and XP... I have amended the Main Default Policy and added the following script...
There is a couple of questions..
1. How do I get the server NOT to run this script when it boots.. Not that it'll be booting that much..
2. The only part of the LogonScript that doesn't work is where it is meant to read the Groups and then Map the drives... This doesn't seem to work.. I have map them manually no problem...
' COMMENT: Enumerates current users' group memberships in given domain.
'
'==========================================================================
ON ERROR RESUME NEXT
Set WSHShell = CreateObject("WScript.Shell")
Set WSHNetwork = CreateObject("WScript.Network")
'Edit the next line with your domain name
DomainString = "LevelFour"
UserString = WSHNetwork.UserName
UserString = UserString & "$"
'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 \\lev4dunpdc001 /set /y"
'Disconnect any drive mappings as needed.
WSHNetwork.RemoveNetworkDrive "F:"
'Give the PC time to do the disconnect, wait 300 milliseconds
wscript.sleep 300
'Map drives needed by all
WSHNetwork.MapNetworkDrive "U:", "\\lev4dunpdc001\"& UserString,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
'In this example below, ADMIN and WORKERB are groups.
Case "GGSales"
WSHNetwork.MapNetworkDrive "M:", "\\lev4dunpdc001\Sales",True
Case "GGDevelopers"
WSHNetwork.MapNetworkDrive "I:", "\\lev4dunpdc001\Development",True
Case "GGDevelopers"
WSHNetwork.MapNetworkDrive "S:", "\\Sol",True
Case "GGIT_Support"
WSHNetwork.MapNetworkDrive "T:", "\\IT_Support",True
End Select
Next
'Install Printers
WSHNetwork.AddWindowsPrinterConnection "\\lev4dunpdc001\Kyocera_FS-3800"
WSHNetwork.AddWindowsPrinterConnection "\\lev4dunpdc001\Magicolor_2350"
'Clean Up Memory We Used
set UserObj = Nothing
set GroupObj = Nothing
set WSHNetwork = Nothing
set DomainString = Nothing
set WSHSHell = Nothing
'Quit the Script
wscript.quit
Thanks in advance for you help.
I have a 2003 SBS as the server, with a mix of W2k and XP... I have amended the Main Default Policy and added the following script...
There is a couple of questions..
1. How do I get the server NOT to run this script when it boots.. Not that it'll be booting that much..
2. The only part of the LogonScript that doesn't work is where it is meant to read the Groups and then Map the drives... This doesn't seem to work.. I have map them manually no problem...
' COMMENT: Enumerates current users' group memberships in given domain.
'
'==========================================================================
ON ERROR RESUME NEXT
Set WSHShell = CreateObject("WScript.Shell")
Set WSHNetwork = CreateObject("WScript.Network")
'Edit the next line with your domain name
DomainString = "LevelFour"
UserString = WSHNetwork.UserName
UserString = UserString & "$"
'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 \\lev4dunpdc001 /set /y"
'Disconnect any drive mappings as needed.
WSHNetwork.RemoveNetworkDrive "F:"
'Give the PC time to do the disconnect, wait 300 milliseconds
wscript.sleep 300
'Map drives needed by all
WSHNetwork.MapNetworkDrive "U:", "\\lev4dunpdc001\"& UserString,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
'In this example below, ADMIN and WORKERB are groups.
Case "GGSales"
WSHNetwork.MapNetworkDrive "M:", "\\lev4dunpdc001\Sales",True
Case "GGDevelopers"
WSHNetwork.MapNetworkDrive "I:", "\\lev4dunpdc001\Development",True
Case "GGDevelopers"
WSHNetwork.MapNetworkDrive "S:", "\\Sol",True
Case "GGIT_Support"
WSHNetwork.MapNetworkDrive "T:", "\\IT_Support",True
End Select
Next
'Install Printers
WSHNetwork.AddWindowsPrinterConnection "\\lev4dunpdc001\Kyocera_FS-3800"
WSHNetwork.AddWindowsPrinterConnection "\\lev4dunpdc001\Magicolor_2350"
'Clean Up Memory We Used
set UserObj = Nothing
set GroupObj = Nothing
set WSHNetwork = Nothing
set DomainString = Nothing
set WSHSHell = Nothing
'Quit the Script
wscript.quit
Thanks in advance for you help.