Page 1 of 1

Ipconfig Description

Posted: 25 Oct 2010 07:02
by Vox
Hello,

I'm writing a script to check what ip number a computer has. This is what i have.

@echo off
ipconfig | find /i "10.160" | find /i "ip" >nul
if %errorlevel%==0 goto install

This script is working, the only thing is i want to check if the ip numer is from a vpn connection. Now i know that ipconfig /all shows also the discription.
But how can i show the ip-number of a network adaptor with the discription "Cisco VPN adaptor"?

so what i want is If a network adaptor has the discription "Cisco VPN" show the IP-adres.

I hope you understand what i want:)

Thanks in advance

Re: Ipconfig Description

Posted: 25 Oct 2010 19:50
by amel27
Vox wrote:so what i want is If a network adaptor has the discription "Cisco VPN" show the IP-adres.

via IPCONFIG:

Code: Select all

@echo off

for /f "skip=1 tokens=2 delims=:" %%a in  (
'ipconfig /all^|findstr /ibrc:" *Description .* Cisco VPN$" /c:" *IP Address"') do if not defined IPAddress (
for /f "tokens=*" %%b in ("%%a") do set "IPAddress=%%b")

echo %IPAddress%
pause>nul

via WMIC:

Code: Select all

@echo off

for /f "skip=1 delims={}" %%a in (
'wmic nicconfig where Description^="Cisco VPN" get IPAddress'
) do if not defined IPAddress set IPAddress=%%~a

echo %IPAddress%
pause>nul

Re: Ipconfig Description

Posted: 26 Oct 2010 07:11
by Vox
Yesss:D Thank you i used the WMIC solution, and it worked like a charm:)