How to know if Lan’s IP was set manually or dynamically?

Asked

Viewed 175 times

3

It is possible, maybe through WMI or using another technique, know if a computer is with your Local network IP (LAN) physically set (manually) or dynamically (usually by DHCP)? Like?

1 answer

3


Following answer "using another technique":

We can always check the log to see if the device is using DHCP or not:

Uses Registry;
var
  Reg:TRegistry;
begin
  Reg:=TRegistry.Create;
  Reg.RootKey:=HKEY_LOCAL_MACHINE;
  Reg.OpenKey('SYSTEM\ControlSet001\services\Tcpip\Parameters\Interfaces\{GUID da sua placa de rede}', False);
  if Reg.ReadInteger('EnableDHCP') = 0 then
    showmessage('Sem DHCP')
  else
    showmessage('Com DHCP');
  Reg.CloseKey;
  Reg.Free;
end;

Thus, you have device status through registration.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.