I am looking for a cmd command to return if the currently connected NIC is using a static or DHCP address. DHCP: YES or NO is acceptable.
I think ipconfig might be an option, but I need a way to sort out the DHCP field as well as make sure the field I am pulling is from the correct adapter.
I found this code which will pull out the IP Address, But I have not be able to adjust the code to pull the DHCP status.
for /f "delims=" %a in ('ipconfig ^| findstr [0-9].\.') do @echo %a | findstr "Address"
I tried
for /f "delims=" %a in ('ipconfig ^| findstr [0-9].\.') do @echo %a | findstr "DHCP Enabled"
and
for /f "delims=" %a in ('ipconfig ^| findstr [0-9].\.') do @echo %a | findstr "DHCP"
but they return nothing. I think im on the right track, I'm just not sure.