Network_CheckDhcpEnabled.ps1

function Network-CheckDhcpEnabled {
            $LinkStatus = Get-NetAdapter | Where-Object -FilterScript {$_.Status -Eq "Up"} | Select-Object 'Name', 'Status'
            $IPs = Get-NetIPAddress 
            foreach ($IP in $IPs){
            if ($IP.InterfaceAlias -eq 'WiFi'){
            Set-NetIPInterface -dhcp --Enabled $LinkStatus.ifIndex
            ipconfig /release /renew 
            }
            }
            Test-Connection (Get-NetRoute -DestinationPrefix $_.IPAddress/$_.PrefixLength | Select-Object -ExpandProperty Nexthop) -Quiet -Count 1 
}