Avoiding output message through [void]

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



I have create a simple function that lists accessible printers on my
current machine like the following.

============================================================
MSH>function get-printers {
>> [void]([reflection.assembly]::LoadWithPartialName("System.Drawing"))
>> [System.Drawing.Printing.PrinterSettings]::InstalledPrinters}
>>
MSH>get-printers
Microsoft Office Document Image Writer
HP LaserJet 8150 PCL 5e(관리국)
HP LaserJet 5000 Series PCL 5e(편집부)
HP LaserJet 5000 Series PCL 5e(Design)
HP LaserJet 4100 PCL 5e(특집부)
HP LaserJet 4100 PCL 5e(사회부)
HP LaserJet 4100 PCL 5e(광고 업무부)
HP LaserJet 4100 PCL 5e(경제부)
HP LaserJet 2430 PCL 5e(전산실)
HP LaserJet 2300 Series PCL 6(Flushing)
HP LaserJet 2300 Series PCL 5e(사업국)
HP Color LaserJet 5500 PCL6(Color)
Adobe PDF

MSH>get-printers

GAC Version Location
--- ------- --------
True v2.0.50727
C:\WINDOWS\assembly\GAC_MSIL\System.Drawing\2.0.0.0__b03f5f7f11d50a3a\Syst....
Microsoft Office Document Image Writer
HP LaserJet 8150 PCL 5e(관리국)
HP LaserJet 5000 Series PCL 5e(편집부)
HP LaserJet 5000 Series PCL 5e(Design)
HP LaserJet 4100 PCL 5e(특집부)
HP LaserJet 4100 PCL 5e(사회부)
HP LaserJet 4100 PCL 5e(광고 업무부)
HP LaserJet 4100 PCL 5e(경제부)
HP LaserJet 2430 PCL 5e(전산실)
HP LaserJet 2300 Series PCL 6(Flushing)
HP LaserJet 2300 Series PCL 5e(사업국)
HP Color LaserJet 5500 PCL6(Color)
Adobe PDF
============================================================

On the first run, I get the list of printers without names.
But on the second time, i get the returned message of
"LoadWithPartialName" function.

So i have added "out-null" like the following
[void]([reflection.assembly]::LoadWithPartialName("System.Drawing")) |
out-null

Now, when everytime i run "get-printers", only printer names are
displayed.

My question being that, why was I getting the output for
"LoadWithPartialName" the second time I ran "get-printers" although in
the first time i wasn't getting it?

My main question is, how could i avoid running "LoadWithPartialName"
everytime I run the command?(I would like to know if a certain assembly
is loaded onto MSH or not)

.



Relevant Pages

  • RE: Slow printing using some HP drivers/printers on TS
    ... But the server or the driver is not the actual main cause. ... settings the time that is needed to show the properties increases enormously. ... HP Color LaserJet 2500 PCL 5c ...
    (microsoft.public.windows.terminal_services)
  • RE: Slow printing using some HP drivers/printers on TS
    ... But the server or the driver is not the actual main cause. ... settings the time that is needed to show the properties increases enormously. ... HP Color LaserJet 2500 PCL 5c ...
    (microsoft.public.windows.terminal_services)
  • Re: hp laser jet 1018
    ... PCL used by the earlier HP LaserJets and the more ... it is not worth the effort to install the PCL drivers for an older ... LaserJet under Windows 98, ...
    (comp.sys.hp.hardware)
  • printer no longer prints
    ... My old Laserjet 4 finally died and, after a gap of about a month, I replaced ... drop-in replacement for the LJ4. ... solaris box driving it in exactly the same way (via ghostscript). ... a file in pcl format and then just cat it to /dev/bpp0 I get a "can't ...
    (comp.unix.solaris)
  • Re: Unnecessary printer drivers
    ... installed HP USB printer driver, ... LaserJet 3050 printers, which marked as 'Auto HP LaserJet 3050 ... 'HP LaserJet 3050 Series PCL 6', ...
    (microsoft.public.windowsxp.help_and_support)