ToddF
2/9/2009 3:29:00 AM
disregard I found the error. no _ between IP & Address.
"Glenn" <nospam@yahoo.com> wrote in message
news:ey$Yw2hiJHA.3708@TK2MSFTNGP04.phx.gbl...
>I am trying the simple solution, but it doesn't work.
>
> Here's exactly what I am typing. (my ip address is 172.16.31.155)
>
> ipconfig | find /i "IP_Address" | find /i "172.16.31" && "bginfo
> c:\bginfo\mysetup.bgi /timer:0"
>
> But it doesn't run.
>
> If i type the bginfo c:\bginfo\mysetup.bgi /timer:0 on a line by itself it
> works fine.
>
> Thanks for any direction you can provide me.
>
>
> "Pegasus (MVP)" <I.can@fly.com.oz> wrote in message
> news:uJA$wGThJHA.3812@TK2MSFTNGP04.phx.gbl...
>>
>> "Glenn" <nospam@yahoo.com> wrote in message
>> news:uNIoyUOhJHA.5244@TK2MSFTNGP06.phx.gbl...
>>> Is it possible to write a startup script that will run a program such as
>>> BGinfo only if the computer is on one of a list of specified subnets?
>>>
>>> For instance, I want my laptops to run this program only if they are
>>> connected to my network internally.
>>>
>>> When they try to run them from the outside, they get an error message
>>> that the SQL server can't be contacted, which of course it can't because
>>> they aren't on the network.
>>>
>>> Thanks.
>>
>> The simplest solution is to insert this line into your startup batch
>> file. It assumes that "192.168.1" is your internal subnet address.
>>
>> ipconfig | find /i "IP_Address" | find /i "192.168.1" && "c:\Program
>> Files\My Folder\My Prog.exe"
>>
>> If you prefer a chatty solution then you can built it on this VB Script:
>>
>> Set oWMIService = GetObject("winmgmts:" _
>> & "{impersonationLevel=impersonate}!\\.\root\cimv2")
>> Set cNicConfigs = oWMIService.ExecQuery("SELECT * FROM " _
>> & "Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")
>> For Each oNICConfig In cNicConfigs
>> For Each sIPAddress In oNICConfig.IPAddress
>> WScript.Echo "Subnet = " & Left(sIPAddress, InStrRev(sIPAddress, ".")-1)
>> Next
>> Next
>>
>>
>
>