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
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