I'm new to using the WshController Object which allows you to create a "controller script' that can run 'worker scripts' against remote computers. I'm in a W2k3 domain and run a xp pro desktop. I would like to essentailly create a vb controller script that reads off a text file of workstations and executes the worker script remotely on the text file and adds a network printer using AddWindowsPrinterConnection.exe
Controller Script would look something like this please excuse the format as I am not a scripter;
<
>
<
>
Thanks in Advance!
Controller Script would look something like this please excuse the format as I am not a scripter;
<
Code:
>
(Controller.vbs)
On Error Resume Next
Const ForReading = 1
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile
("c:\scripts\wrkstns.txt", ForReading)
Do Until objTextFile.AtEndOfStream
strComputer = objTextFile.Readline
Dim oController, oRemoteScript
Set oController = WScript.CreateObject ("WSHController")
Set oRemoteScript = oController.CreateScript ("C:\scripts\addprinter.vbs", "text file here of workstation names.txt")
WScript.ConnectObject oRemoteScript, "remote_"
oRemoteScript.Execute
Do While oRemoteScript.Status = 0
WScript.Sleep 100
Loop
MsgBox "remote execution completed with Status= " & oRemoteScript.Status
Loop
objTextFile.Close
<
<
Code:
>
Worker script(Addprinter.vbs)
Set WshNetwork = WScript.CreateObject("WScript.Network")
PrinterPath = "\\servername\HPLJ_4100_3rd_Floor"
WshNetwork.AddWindowsPrinterConnection PrinterPath
WshNetwork.SetDefaultPrinter PrinterPath
<
Thanks in Advance!