![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Just a bit of background: I have some machines that, occassionly, lose contact with their default printer and, as a result their 'Use Printer Online/Use Printer Offline' setting becomes toggled to 'Offline'. The users, of course' are quite merrily 'printing' away become perplexed as to why the printer is not printing anything. I have determined that I can use the WMI Win32_Printer class to ascertain if a given printer is considered to be 'Offline' but I can't figure out how to toggle the appropriate attribute for a given printer. The following fragment nicely lists the installed printers along with a note if a given printer is 'Offline': Dim _scope As New ManagementScope("\root\cimv2") _scope.Connect() Dim _searcher As New ManagementObjectSearcher("select * from win32_printer") For Each _printer As ManagementObject In _searcher.Get() Console.Write("{0}", _printer("name")) If Convert.ToBoolean(_printer("workoffline")) Then Console.Write(" (Offline)") Console.WriteLine() Next Obviously, becaue I can determine the name of the default printer, I can target a specific printer. Does anyone have a fragment to share that demonstrates how to go about setting the 'workoffline' attribute (or, for that matter, any other attribute of the Win32_Printer class)? |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |