VBScript using admin from another domain and pulling in data from file
Posted on 2010-11-10
I administer 3 separate domains. I obviously have an admin account on all domain. I wanted to run a script remotely on machines in a domain that I am not currently logged into. I can access the domain via IP and when prompted I can simply enter my info for that domain to access files, PCs, servers etc.
I am new to scripting and already have a script to check what printers are already installed on a remote machine.
The problem is running the script on a remote machine within another domain. I know I can conenct to a server or PC and run it from there but wanted to know if there was a way to run it without doing logging into a machine on that domain.
ALSO... Is there a way to insert/pull computer names or IP addresses into a script and then print out the result to a file? Currently the script only prints to the screen.
Below is the current script:
strComputer = "remotePCName"
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colPrinters = objWMIService.ExecQuery("Select * From Win32_Printer")
For Each objPrinter in colPrinters
If objPrinter.Attributes And 64 Then
strPrinterType = "Local"
strPrinterType = "Network"
Wscript.Echo objPrinter.Name & " -- " & strPrinterType