PDA

View Full Version : Login scripts for Windows 2000 Domain (W2K)



gregch
06-06-2002, 02:21 PM
Does anyone know how to effectively use login scripts to log on to a Windows 2000 Domain and run a batch file - in this order? I would like to run a login script when a user logs on to the network. After this is finished, run a batch file that calls an audit program which copies files to our servers.
Any help would be greatly appreciated.

RobertThunell
06-25-2002, 08:10 AM
First you must add the script to the Group Policies for the domain.

The Batch.bat file you have to create yourself, IŽll donŽt know what you want...
ShouldnŽt be so difficult ;)




Dim WSHNetwork
Dim WSHShell
Dim WshSysEnv

Set WshNetwork = WScript.CreateObject("WScript.Network")
Set WSHShell = WScript.CreateObject("WScript.Shell")
Set WshSysEnv = WshShell.Environment("PROCESS")

' ****** Network Mappings

WScript.Echo "Please Wait, Network Connections Are Being Added "

WshNetwork.MapNetworkDrive "H:", "\\Server\" & WshSysEnv("USERNAME") & "$" 'This would be a users personal drive \\Server\%Username%$
WshNetwork.MapNetworkDrive "G:", "\\Server\Mappings"

' ****** Printer Additions

Sub Printer1
PrinterPath = "\\RoTh\PRINTERNAME"
PrinterDriver = "HP LaserJet 4050 Series PCL"
WshNetwork.AddWindowsPrinterConnection PrinterPath, PrinterDriver
End Sub

' ****** Call Statements

Call BatchRun1
Sub BatchRun1
WshShell.Run ("Batch.bat") ' Batch that removes network connections and then syncs up time with domain controller
End Sub

WScript.Echo "All Done"
WScript.Quit