First things first.......
I'm trying to get a list of network mapped printers on all of the
workstations in our domain and put into a file. The following DOES work if
ran locally, but NOT if executed from a remote computer. Below lists the
local vbs script that is trying to be executed and the script from the server
that tries to execute the local script. Any ideas would be helpful.
PS: I'm not the finest code writer......just starting
Thanks,
Brian
------------------------------------------------------
Below script runs and tries to execute a script on each workstation
-------------------------------------------------------
Function findprinters(strcomputer)
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CopyFile "C:\Scripts\printers_local.vbs", "\\" & strcomputer &
"\C$\Admin\", True
Set objWMIService = GetObject ("winmgmts:\\" &
"{impersonationLevel=impersonate}!\\" & strComputer &
"\root\cimv2:Win32_Process")
' Set objWMIService = GetObject("winmgmts:" &
"{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
objWMIService.Create "cscript.exe c:\admin\printers_local.vbs", null, null,
intProcessID
wscript.sleep(2000)
End Function
-----------------------------------------------------
local vbs script on workstations that puts printers into a file
-----------------------------------------------------
strComputer = "."
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile("\\nywpsmsm03\printer_logs\" &
"printer_log_" & datestring & ".txt", ForAppending)
Set objWMIService = GetObject("winmgmts:" &
"{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colPrinters = objWMIService.ExecQuery("Select * From Win32_Printer")
For Each objPrinter in colPrinters
strstring = strstring & objprinter.name & "*"
Next
objTextFile.Write strstring & vbcrlf
---------------------------------------------------