Hi Thomas,
these are Windows 2003 / 2000 Server.
Thank you, Ronny.
Please read the posting guidelines posted here regularly. You should quote
the relevant context in a reply.
Here is an example how to get at the network adapter configuration with
WMI. For further information get the WMI Tools from M$ and read the docs
for Win32::OLE
Thomas
use strict;
use warnings;
use Win32::OLE qw/in/;
Win32::OLE->Option(Warn => 1);
for my $mach ( @ARGV ) {
print "$mach:\n";
for my $nwa ( GetNWA($mach) ) {
no warnings 'uninitialized';
print " MAC Address: $nwa->{MACAddress}\n";
print " IPAddresses: ",
join(', ', in($nwa->{IPAddress})),
"\n";
print " Gateways: ",
join(', ', in($nwa->{DefaultIPGateway})),
"\n";
}
}
sub GetNWA {
my($machine) = @_;
my $wmi = Win32::OLE->GetObject(
"winmgmts:{impersonationLevel=impersonate}\\\\$machine\\root\\cimv2"
) or
die 'error initializing WMI interface for $machine',
Win32::OLE->LastError;
my @nwa = grep {
$_->{IPEnabled}
} in($wmi->InstancesOf('Win32_NetworkAdapterConfiguration'));
return(@nwa);
}
--
$/=$,,$_=<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^.-