The problem is likely that your script is throwing an unhandled error. With
WScript.exe as the default host, you may not see the WSH error dialog box
when the script does not execute in the context of the visible desktop.
> I will be trying this command line shortly (after reading some
> previous newsgroup posts about cscript and wscript):
> C:\WINDOWS\system32\cscript.exe C:\get-ip.vbs //B //T:180
>
I would do
%comspec% /c cscript.exe C:\get-ip.vbs //B > c:\get-ip.output.txt
That way any error message written to standard output won't be lost...
> Below is the entire IP script
Here's a simpler way to get your own IP address by pinging your own machine
name...
wscript.echo myipaddress
function MyIPAddress()
MyIPAddress = ""
set net = createobject("wscript.network")
set shell = createobject("wscript.shell")
set re = new regexp
re.pattern = "\[(.+)?\]"
with shell.exec("ping -n 1 -w 500 " & net.computername)
set wsxOut = .stdout
do: wscript.sleep 10
do until wsxOut.atendofstream
line = wsxOut.readline
if re.test(line) then
MyIPAddress = re.execute(line)(0).submatches(0)
end if
loop
loop until .status <> 0 and wsxOut.atendofstream
end with
end function
--
Michael Harris
Microsoft.MVP.Scripting
Microsoft® Windows®2000 Scripting Guide
http://www.microsoft.com/technet/scriptcenter/scrguide/sagsas_overview.asp
TechNet Script Center Sample Scripts
http://www.microsoft.com/downloads/release.asp?ReleaseID=38942
WSH 5.6 documentation download
http://www.microsoft.com/downloads/details.aspx?FamilyId=01592C48-207D-4BE1-8A76-1C4099D7BBB9&displaylang=en
>> I will be trying this command line shortly (after reading some
>> previous newsgroup posts about cscript and wscript):
>> C:\WINDOWS\system32\cscript.exe C:\get-ip.vbs //B //T:180
>>
>I would do
>
>%comspec% /c cscript.exe C:\get-ip.vbs //B > c:\get-ip.output.txt
>
>That way any error message written to standard output won't be lost...
>
Michael,
I'll try the redirect to get-ip.output.txt to see what happens when
the script fails to stop. I don't think I mentioned that the script
will run properly in the Scheduled Tasks for 3-4 days, but then it
just stays running (as per the Scheduled Tasks --> view log).
>
>
>> Below is the entire IP script
>
>
>Here's a simpler way to get your own IP address by pinging your own machine
>name...
>
>wscript.echo myipaddress
>
When beind a router, the IP Address on your local machine (normally a
192.168.x.x number) isn't your internet (WAN ip address). For
machines that are directly connected to the internet, I use a .bat
script that runs ipconfig and greps for the line IP Address:.....
--CC
> Below is the entire IP script
> --CC
>
>
> ' ######## Start of WhatIsMyIp script #######
> dim oXML, oFSO, oFile
> dim strOutFile, strOpenURL, strTimeDate, strHTML
> dim intTimeout, i
>
> ' strOutFile is the file that the IP address will be written to
> strOutFile="c:\ext-ip.txt"
>
> ' strOpenURL is the Website to find your IP address from
> strOpenURL="http://www.whatismyip.com"
>
Using a third-party site to echo back your IP address introduces
complexity/uncertainty to the success of your script.
Your router should have an admin/status page. I've had good
results parsing my IP out of that HTML, the only difference
being that you need to provide the username/pwd of the admin page.
The oXML.Open() method has arguments for those.
If there is any possiblity that whatismyip.com is filtering
(with CGI scripts) some clients requests, then you should be
better off requesting from your own router, from within your own LAN.
hth,
Mark Pryor