I wrote up this VBS script and it should do what you want, I have it so it will just display the results. If you get the results you want I will add the cmd that you need to run. Save CheckIpRunCmd.vbs Dim Wmi :Set Wmi = GetObject("winmgmts:\\.\root\CIMV2") Dim Ip, Z1, Z2 '-> Loop To Get Local Machine IP For Each Obj in Wmi.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration") If not isNull(Obj.IPSubnet) Then If not isNull(Obj.IPAddress) Then Z1 = Join(Obj.IPAddress, ",") If Len(Z1) <= 15 Then Ip = Z1 ElseIf Len(Z1) >= 16 Then '-> Vista And Win 7 Return Ipv4 And Ipv6 This Gets Ipv4 Address Z2 = Split(Z1, ",") Ip = Z2(0) End If End If End If Next '-> Compare IP If Ip > "192.168.10.1" And Ip < "192.168.10.255" Then WScript.Echo "Confirm Ip " & Ip & vbCrLf & "Run Cmd 1" ElseIf Ip > "192.168.20.1" And Ip < "192.168.20.255" Then WScript.Echo "Confirm Ip " & Ip & vbCrLf & "Run Cmd 2" ElseIf Ip > "192.168.30.1" And "Ip" < "192.168.30.255" Then WScript.Echo "Confirm Ip " & Ip & vbCrLf & "Run Cmd 3" Else WScript.Echo "Ip Address Is Not Within Search Range" & vbCrLf & "Ip Address " & Ip End If