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

3

Maybe WMI or using another technique, find out if a computer is LAN or dynamically (usually by DHCP) ? How?

    
asked by anonymous 07.05.2014 / 15:03

1 answer

3

We can always check the registry 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;

So you have the status of the device through the registry.

    
07.05.2014 / 19:29