Detecting DHCP

What is the best way to detect DHCP running on a computer using perl and then actually getting that dynamic IP address?  Is there a Win32 module or function call that I can use?
paulcaAsked:
Who is Participating?
 
maneshrConnect With a Mentor Commented:
i think, on NT boxes you can use the ipconfig /all to find and get the IP address.

all that you need to do is use basic PERL parse capabilities to parse thru the output and extract the relevant info.

as an sg. i have this small program which will give you the IP address of the machine on which its running.

## call the external command & get its output
$output=`ipconfig /all`;

## Remove the enter char at the end of the output
chomp($output);

## Parse for and extract the ip address
$output=~ /\s+IP Address.*:\s+(\d+.*)/;
$ip_address=$1;

## print the ip address!!
print $ip_address,"\n";
0
 
makerpCommented:
just see if 'ipconfig /all' displayed an ip address next to the DHCP server entry .

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.