InterfaceIP/InterfaceIP.psm1

<#
.SYNOPSIS
 
Gets the IP addresses which are assigned by DHCP(Router OR Ethernet Connection) to the interface.
 
.DESCRIPTION
 
The Get-InterIP cmdlet Gives the IP addresses which were assigned by DHCP to the interfaces (ethernet or wi-fi).
This also gives the DHCP details and also the Lease Obtained Duration.
 
.EXAMPLE
PS> Get-InterIP
  
The IP Records are :
  
DHCP IP ADDRESS : 192.168.0.147
DHCP SUBNET MASK : 255.255.255.0
DHCP SERVER : 192.168.0.1
DHCP DOMAIN : www.tendawifi.com
DHCP NAME SERVER : 192.168.0.1
LEASE : 24 HOUR(S)
#>


Function Get-InterIP {
    
    $x = Get-ItemProperty "HKLM:\SYSTEM\ControlSet001\Services\Tcpip\Parameters\Interfaces\*\*"
    $x += Get-ItemProperty "HKLM:\SYSTEM\ControlSet001\Services\Tcpip\Parameters\Interfaces\*"

        Write-Host " "
        Write-Host "The IP Records are : "
        Write-Host " "

    $Count = 0
    while ($Count -ine $x.count)
    {
        $y = $x[$Count].DhcpIPAddress
    
        if ($y -ne $null)
        {
        $L = $x[$Count].Lease
        $O = $L/60/60
        Write-Host " "
        Write-Host "DHCP IP ADDRESS : " $x[$Count].DhcpIPAddress
        write-Host "DHCP SUBNET MASK : " $x[$Count].DhcpSubnetMask
        Write-Host "DHCP SERVER : " $x[$Count].DhcpServer
        write-Host "DHCP DOMAIN : " $x[$Count].DhcpDomain
        write-Host "DHCP NAME SERVER : " $x[$Count].DhcpNameServer
        Write-Host "LEASE : " $O "HOUR(S)"
        }
        $y = $null
            $Count++

    }
}