Re: Win32::Printer::Enum::Printer($server)
- From: Thomas Kratz <ThomasKratz@xxxxxxxxxxxxxxxx>
- Date: Mon, 27 Jun 2005 11:42:35 +0200
Brian McCauley wrote:
Has anyone ever managed to get Win32::Printer::Enum::Printer($server) to enumerate printers on a server?
I tend to use WMI these days. You might want to try this:
use strict; use warnings;
use Win32::OLE qw/in/; Win32::OLE->Option(Warn => 1);
$ARGV[0] ||= '';
my $wmi = Win32::OLE->GetObject(
"winmgmts:{impersonationLevel=impersonate,(security)}$ARGV[0]"
) or die
"error initializing WMI interface, ",
Win32::OLE->LastError;my @attrib = qw/DeviceID Name DriverName Location Comment/;
print join(', ', @attrib), "\n";
for my $p ( in($wmi->InstancesOf('Win32_Printer')) ) {
$_ ||= '' for @$p{@attrib};
print join(', ', @$p{@attrib}), "\n";
}Thomas
-- $/=$,,$_=<DATA>,s,(.*),$1,see;__END__ s,^(.*\043),,mg,@_=map{[split'']}split;{#>J~.>_an~>>e~......>r~ $_=$_[$%][$"];y,<~>^,-++-,?{$/=--$|?'"':#..u.t.^.o.P.r.>ha~.e.. '%',s,(.),\$$/$1=1,,$;=$_}:/\w/?{y,_, ,,#..>s^~ht<._..._..c.... print}:y,.,,||last,,,,,,$_=$;;eval,redo}#.....>.e.r^.>l^..>k^.- .
- References:
- Win32::Printer::Enum::Printer($server)
- From: Brian McCauley
- Win32::Printer::Enum::Printer($server)
- Prev by Date: Re: Installing a CPAN Module online
- Next by Date: Can't call method <function> on an undefined value at <module>
- Previous by thread: Re: Win32::Printer::Enum::Printer($server)
- Next by thread: SSLeay & OpenSSL problem with install of IO::Socket::SSL
- Index(es):