Re: VBS script not running when user logs into windows
- From: Jwolfer <Jwolfer@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 9 Jun 2006 05:19:01 -0700
'**********************************************************************************
' Set Environment Variables
'*********************************************************************************
Set WSHNetwork = WScript.CreateObject("WScript.Network")
Set WSHShell = WScript.CreateObject("WScript.Shell")
On Error Resume Next
Domain = WSHNetwork.UserDomain
UserName = ""
While UserName = ""
UserName = WSHNetwork.UserName
MyGroups = GetGroups(Domain, UserName)
Wend
'*********************************************************************************
' Main Process:
'*********************************************************************************
GrpMeb UserName
ShowBox
Wscript.Quit
'*********************************************************************************
'Function: GetGroups
'*********************************************************************************
Function GetGroups(Domain, UserName)
Set objUser = GetObject("WinNT://" & Domain & "/" & UserName)
GetGroups=""
For Each objGroup In objUser.Groups
GetGroups=GetGroups & "[" & UCase(objGroup.Name) & "]"
Next
End Function
'********************************************************************************
'Function: InGroup
'********************************************************************************
Function InGroup(strGroup)
InGroup=False
If InStr(MyGroups,"[" & UCase(strGroup) & "]") Then
InGroup=True
End If
End Function
'*********************************************************************************
' MapDrives Subroutine
'*********************************************************************************
Sub MapDrive(sDrive,sShare)
On Error Resume Next
WSHNetwork.RemoveNetworkDrive sDrive, 1, 1
wscript.sleep 1000
Err.Clear
WSHNetwork.MapNetworkDrive sDrive,sShare
End Sub
'********************************************************************************
'Map Drives:
'********************************************************************************
Sub GrpMeb(UNAME)
If INGROUP ("domain users") Then
MapDrive "H:", "\\FILESERVER01\GENERAL OFFICE DOCUMENTS"
End If
If INGROUP ("Images Existing") Then
MapDrive "I:", "\\FILESERVER01\IMAGES EXISTING"
End If
If INGROUP ("domain users") Then
MapDrive "J:", "\\FILESERVER01\ACAD SUPPORT"
End If
If INGROUP ("domain users") Then
MapDrive "K:", "\\FILESERVER01\PROJECTS"
End If
If INGROUP ("Marketing") Then
MapDrive "M:", "\\FILESERVER01\MARKETING"
End If
If INGROUP ("Marketing") Then
MapDrive "O:", "\\FILESERVER01\POWERPOINTS"
End If
If INGROUP ("domain users") Then
MapDrive "P:", "\\FILESERVER01\EMPLOYEE STUFF\" & username
End If
If INGROUP ("domain users") Then
MapDrive "Q:", "\\FILESERVER01\COMMON"
End If
If INGROUP ("domain users") Then
MapDrive "R:", "\\FILESERVER01\REVIT SUPPORT"
End If
If INGROUP ("domain users") Then
MapDrive "S:", "\\FILESERVER01\PROJECTS2"
End If
If INGROUP ("MIS") Then
MapDrive "U:", "\\FILESERVER01\MIS"
End If
If INGROUP ("domain users") Then
MapDrive "W:", "\\FILESERVER01\ARCHIVES"
End If
If INGROUP ("administrators") Then
MapDrive "X:", "\\DAVINCI\APPS"
End If
Return = WSHShell.Run("\\DAVINCI\netlogon\runas\runprog.exe
\\DAVINCI\netlogon\runas\netsend.bat", 5, true)
Return = WSHShell.Run("regedit /s \\DAVINCI\netlogon\runas\dragdrop.reg", 5,
true)
Return = WSHShell.Run("\\DAVINCI\netlogon\runas\screensavercopy.bat", 5, true)
If INGROUP ("acad laptops") Then
Return = WSHShell.Run("\\DAVINCI\netlogon\runas\ACADLaptop.bat", 5, true)
End If
strCmd = "net.exe time Davinci /set /yes >null"
WshShell.Run strCmd, 0
End Sub
.
- Follow-Ups:
- Re: VBS script not running when user logs into windows
- From: Dave Britt
- Re: VBS script not running when user logs into windows
- References:
- Re: VBS script not running when user logs into windows
- From: Dave Britt
- Re: VBS script not running when user logs into windows
- Prev by Date: Re: Deny adding users to local administrators group
- Next by Date: Re: Deny adding users to local administrators group
- Previous by thread: Re: VBS script not running when user logs into windows
- Next by thread: Re: VBS script not running when user logs into windows
- Index(es):
Relevant Pages
|