NAME

Win32::IPConfig::Adapter - Windows NT/2000/XP Network Adapter IP Configuration Settings

SYNOPSIS

print $adapter->get_id, "\n";
print $adapter->get_description, "\n";

if ($adapter->is_dhcp_enabled) {
    print "DHCP is enabled\n";
} else {
    print "DHCP is not enabled\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 servers=@dns (", scalar @dns, ")\n";

@wins = $adapter->get_wins;
print "wins servers=@wins (", scalar @wins, ")\n";

DESCRIPTION

Win32::IPConfig::Adapter encapsulates the TCP/IP configuration settings for a Windows NT/2000/XP network adapter.

METHODS

$adapter->get_id

Returns the service name where the adapter settings are stored.

$adapter->get_description

Returns the Network Adapter Description.

$adapter->is_dhcp_enabled

Returns 1 if DHCP is enabled, 0 otherwise. If DHCP is enabled, the values returned from the get_ipaddresses, get_gateways, get_domain, get_dns, and get_wins methods will be retrieved from the DHCP-specific registry keys.

$adapter->get_ipaddresses

Returns a list of ip addresses for this adapter. (Returns a reference to a list in a scalar context.)

$adapter->get_subnet_masks

Returns a list of subnet masks for this adapter. (Returns a reference to a list in a scalar context.) The order of subnet masks follows the order of ip addresses, so, for example, the 2nd subnet mask will match the 2nd ip address.

$adapter->get_gateways

Returns a list containing the default gateway ip addresses. (Returns a reference to a list in a scalar context.) If no default gateways are configured, an empty list will be returned. Statically configured default gateways will override any assigned by DHCP.

(Bet you didn't realise Windows allowed you to have multiple default gateways.)

$adapter->get_domain

Returns the connection-specific domain suffix. This is only available on Windows 2000 and later. A statically configured domain will override any assigned by DHCP.

(As a convenience, this will return the host-specific DNS suffix on Windows NT machines.)

$adapter->get_dns

Returns a list containing DNS server ip addresses. (Returns a reference to a list in a scalar context.) If no DNS servers are configured, an empty list will be returned. Statically configured DNS Servers will override any assigned by DHCP.

$adapter->get_wins

Returns a list containing WINS server ip addresses. (Returns a reference to a list in a scalar context.) If no WINS servers are configured, an empty list will be returned. Statically configured WINS Servers will override any assigned by DHCP.

$adapter->set_domain($domainsuffix)

On Windows 2000/XP, sets the connection-specific DNS suffix. On Windows NT, as a convenience, sets the host-specific DNS suffix.

You will not be allowed to set this value if the host adapter is configured through DHCP.

On Windows NT systems, the setting appears to take effect immediately. On Windows 2000 systems, the setting does not appear to take effect until the DNS Client service is restarted or the machine is rebooted.

$adapter->set_dns(@dnsservers)

Sets the DNS servers to @dnsservers. You can use an empty list to remove all configured DNS servers.

You will not be allowed to set this value if the host adapter is configured through DHCP.

On Windows NT systems, you will need to reboot for this setting to take effect. On Windows 2000 systems, you will need to restart the DNS Client service or reboot the machine.

$adapter->set_wins(@winsservers)

Set the host's WINS servers to @winsservers, which should be a list of contactable WINS servers on the network. You can use an empty list to remove all configured WINS servers.

You will not be allowed to set this value if the host adapter is configured through DHCP.

On Windows NT systems, you will need to reboot for this change to take effect. On Windows 2000, you also appear to need to reboot the host machine.

$adapter->get_dhcp_server

Returns the ip address of the DHCP server that supplied the adapter's ip address.

You will only be able to read this value if the host adapter is configured through DHCP.

$adapter->get_dhcp_lease_obtained_time

Returns the lease obtained time in the format YYYY-MM-DD HH-MM.

You will only be able to read this value if the host adapter is configured through DHCP.

$adapter->get_dhcp_lease_terminates_time

Returns the lease terminates time in the format YYYY-MM-DD HH-MM.

You will only be able to read this value if the host adapter is configured through DHCP.

AUTHOR

James Macfarlane, <jmacfarla@cpan.org>

SEE ALSO

Win32::IPConfig