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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

WMI and Arrays

Status
Not open for further replies.

djcamo

Technical User
Jun 4, 2003
7
AU
Hi,

I have just started playing with VB scripts and have decided to use some of the WMI procedure calls in VB. This particular bit of code is basically a printer status utility for all printers running in the office. I want to have a form that shows the printer name and it's status. The code below shows how to get the list of printers on the server - what I can't figure out is how to put each printer (objPrinter) into an array. Any help would be much apprciated.

Regards

djcamo

strComputer = "meldat02"
objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
colInstalledPrinters = objWMIService.ExecQuery("Select * from Win32_Printer")

For Each objPrinter In colInstalledPrinters

strPrinter(i) = objPrinter.Name

Next




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top