Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Remote Printerinfo

Status
Not open for further replies.

dukkse

Technical User
Oct 15, 2003
42
US
Hey!!

I have this script, and it's collecting printer info from servers out in our network and puts it in a textfile. The funny thing is that it works sometimes, but not all the time.
It gets stuck on the GetObject(objServer).Instances
The servers I want to collect data from is NT4 and NT4 Terminal Servers

Please advise, or maybe how to make it better

server = servername
objServer = "winmgmts://" & server
Set Printerset = GetObject(objServer).InstancesOf"Win32_Printer")
SPrnFile = "\\server\path\path\" & site & "\" & Server & "_Printers.txt"
Set SPrn = fso_OpenTextFile(SPrnFile, 2, True)
Sprn.Writeline "PrinterName PrinterShare PrinterModel PORT"
Sprn.Writeline "--------------------------------------------------------------------------------------------------------"
For each Printer in PRinterset
Sprn.Write Printer.Name & " "
Sprn.Write Printer.Sharename & " "
Sprn.Write Printer.DriverName & " "
Sprn.Write Printer.Portname & " "
Sprn.Writeline
Next

Thanks
Daniel
 
Does the script work consistantly on the same servers and consistantly not on other servers? If so I'd be willing to bet that the problem is realted to WMI. You probably need to install the WMI Core components on the NT4 boxes.
 
This script is running on a 2003 server, but collects info from NT4 boxes...

Thanks
 
Hello dukkse,

[1] I suppose that is only an excerpt of the complete script. But, make sure you close the text output file. The times that do not work may well be the file is not closed, meaning data lost.
[2] I hope it is just a typo---a missing "(" after instancesof. Try use these:
Code:
objServer = "winmgmts://" & server & "/root/cimv2"
Set Printerset = GetObject(objServer).InstancesOf("Win32_Printer")
regards - tsuji
 
ADDED INFO:

What I did notice though, is that it works fine when the line to the remote site is good (good speed), and it crashes out when it's slow. Could this be the issue???

/Daniel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top