Advertisement
Advertisement
| 05.27.2008 at 08:11AM PDT, ID: 23435088 |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: |
'==========================================================================
'
' NAME: LoginScript.vbs
'
' AUTHOR: Mark D. MacLachlan, The Spider's Parlor
' URL : http://www.thespidersparlor.com
' Copyright (c) 2003-2007
' DATE : 4/10/2003
'
' COMMENT: Enumerates current users' group memberships in given domain.
' Maps and disconnects drives.
'
'==========================================================================
ON ERROR RESUME NEXT
Dim WSHShell, WSHNetwork, objDomain, DomainString, UserString, UserObj, Path
Set WSHShell = CreateObject("WScript.Shell")
Set WSHNetwork = CreateObject("WScript.Network")
'Automatically grab the user's domain name
DomainString = Wshnetwork.UserDomain
'Find the Windows Directory
WinDir = WshShell.ExpandEnvironmentStrings("%WinDir%")
'Grab the user name
UserString = WSHNetwork.UserName
'Bind to the user object to get user name and check for group memberships later
Set UserObj = GetObject("WinNT://" & DomainString & "/" & UserString)
'Grab the computer name for use in add-on code later
strComputer = WSHNetwork.ComputerName
'Disconnect any drive mappings as needed.
WSHNetwork.RemoveNetworkDrive "H:", True, True
WSHNetwork.RemoveNetworkDrive "J:", True, True
WSHNetwork.RemoveNetworkDrive "K:", True, True
WSHNetwork.RemoveNetworkDrive "M:", True, True
WSHNetwork.RemoveNetworkDrive "P:", True, True
WSHNetwork.RemoveNetworkDrive "Q:", True, True
WSHNetwork.RemoveNetworkDrive "R:", True, True
WSHNetwork.RemoveNetworkDrive "S:", True, True
WSHNetwork.RemoveNetworkDrive "T:", True, True
WSHNetwork.RemoveNetworkDrive "U:", True, True
'Give the PC time to do the disconnect, wait 200 milliseconds
wscript.sleep 200
'Map drives needed by all
'Note the first command uses the user name as a variable to map to a user share.
'WSHNetwork.MapNetworkDrive "H:", "\\server\users\" & UserString,True
WSHNetwork.MapNetworkDrive "S:", "\\nas\scratch",True
'Now check for group memberships and map appropriate drives
'Note that this checks Global Groups and not domain local groups.
For Each GroupObj In UserObj.Groups
'Force upper case comparison of the group names, otherwise this is case sensitive.
Select Case UCase(GroupObj.Name)
'Check for group memberships and take needed action
'In this example below, ADMIN and WORKERB are groups.
'Note the use of all upper case letters as mentioned above.
'Note also that the groups must be Global Groups.
Case "MEETINGS"
WSHNetwork.MapNetworkDrive "h:", "\\nas\meetings",True
Case "DEBT"
WSHNetwork.MapNetworkDrive "j:", "\\nas\superdebt",True
WSHNetwork.MapNetworkDrive "m:", "\\nas\superdebt\Mip2006",True
Case "IMIS"
WSHNetwork.MapNetworkDrive "k:", "\\nas\imis\reports",True
Case "DORN"
WSHNetwork.MapNetworkDrive "m:", "\\nas\dorn",True
Case "SALARY"
WSHNetwork.MapNetworkDrive "p:", "\\nas\salary",True
Case "LEGTRACKING"
WSHNetwork.MapNetworkDrive "q:", "\\nas\winleg",True
Case "WAGESALARY"
WSHNetwork.MapNetworkDrive "r:", "\\nas\wagescac",True
Case "ATTORNEYS"
WSHNetwork.MapNetworkDrive "t:", "\\nas\attorney",True
Case "INSURANCE"
WSHNetwork.MapNetworkDrive "u:", "\\nas\insurance",True
End Select
Next
' This section of script will prevent the balloon window
' that appears when printing to a network shared printer
' after XP Service Pack 2 is installed.
'=====================================
Path = "HKCU\Printers\Settings\EnableBalloonNotificationsRemote"
WshShell.RegWrite Path, 0 ,"REG_DWORD"
'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
|