Win32::IPConfig::Adapter - Network Adapter IP Configuration Settings for Windows NT/2000/XP/2003 |
Win32::IPConfig::Adapter - Network Adapter IP Configuration Settings for Windows NT/2000/XP/2003
use Win32::IPConfig;
$host = shift || ""; if ($ipconfig = Win32::IPConfig->new($host)) { print "hostname=", $ipconfig->get_hostname, "\n";
print "domain=", $ipconfig->get_domain, "\n";
my @searchlist = $ipconfig->get_searchlist; print "searchlist=@searchlist (", scalar @searchlist, ")\n";
print "nodetype=", $ipconfig->get_nodetype, "\n";
print "IP routing enabled=", $ipconfig->is_router ? "Yes" : "No", "\n";
print "WINS proxy enabled=", $ipconfig->is_wins_proxy ? "Yes" : "No", "\n";
print "LMHOSTS enabled=", $ipconfig->is_lmhosts_enabled ? "Yes" : "No", "\n";
print "DNS enabled for netbt=", $ipconfig->is_dns_enabled_for_netbt ? "Yes" : "No", "\n";
foreach $adapter ($ipconfig->get_adapters) { print "\nAdapter '", $adapter->get_name, "':\n";
print "Description=", $adapter->get_description, "\n";
print "DHCP enabled=", $adapter->is_dhcp_enabled ? "Yes" : "No", "\n";
@ipaddresses = $adapter->get_ipaddresses; print "IP addresses=@ipaddresses (", scalar @ipaddresses, ")\n";
@subnet_masks = $adapter->get_subnet_masks; print "subnet masks=@subnet_masks (", scalar @subnet_masks, ")\n";
@gateways = $adapter->get_gateways; print "gateways=@gateways (", scalar @gateways, ")\n";
print "domain=", $adapter->get_domain, "\n";
@dns = $adapter->get_dns; print "dns=@dns (", scalar @dns, ")\n";
@wins = $adapter->get_wins; print "wins=@wins (", scalar @wins, ")\n"; } }
Win32::IPConfig::Adapter encapsulates the TCP/IP configuration settings for a Windows NT/2000/XP/2003 network adapter.
(Bet you didn't realise Windows allowed you to have multiple default gateways.)
Connection-specific domain name suffixes were introduced on Windows 2000. Windows NT machines do not support connection-specific domain names, so when run on Windows NT this method will return the domain name suffix for the host: all adapters on a Windows NT machine will therefore return the same domain name.
Only Windows 2000 and later have DNS servers configured per adapter. Windows NT machines store the DNS servers as a property of the host, not of the adapter, so when run on Windows NT this method will return the DNS servers set for the host: all adapters on a Windows NT machine will therefore return the same DNS servers.
You will only be able to read this value if the host adapter is configured through DHCP.
You will only be able to read this value if the host adapter is configured through DHCP.
You will only be able to read this value if the host adapter is configured through DHCP.
set_domain($domain_suffix)
You will not be allowed to set this value if the host adapter is configured through DHCP.
When tested on a Windows NT system, the setting appeared to take effect immediately. When tested on a Windows 2000 system, the setting did not appear to take effect until the DNS Client service was restarted or the machine was rebooted.
set_dns(@dns_servers)
You will not be allowed to set this value if the host adapter is configured through DHCP.
When tested on a Windows NT system, the machine needed to be rebooted for it to take effect. When tested on a Windows 2000 system, the DNS Client service needed to be restarted or the machine rebooted.
set_wins(@wins_servers)
You will not be allowed to set this value if the host adapter is configured through DHCP.
When tested on a Windows NT system, the machine needed to be rebooted for the change to take effect. When tested on a Windows 2000 system, the machine also needed to be rebooted.
Win32::IPConfig
James Macfarlane, <jmacfarla@cpan.org>
Copyright (C) 2003,2004,2006,2010 by James Macfarlane
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
Win32::IPConfig::Adapter - Network Adapter IP Configuration Settings for Windows NT/2000/XP/2003 |