hello,
I have this script that I use on a servicedesk.

Basically it starts the Telnet service on a remote PC and then connects me
to it.

myans = Inputbox("Enter PC Name or IP address")
Dim objShell
Set objShell = CreateObject("WScript.Shell")
objShell.Run "sc \\"& myans &" config tlntsvr start= auto"
objShell.Run "sc \\"& myans &" start TlntSvr"
objShell.Run "telnet " & myans

'objShell.Run "sc \\"& myans &" stop TlntSvr"
'WScript.Quit
Set objShell =nothing


What I want it to do is wait until the telnet program is closed my mysef
then run the following bit of code.

objShell.Run "sc \\"& myans &" stop TlntSvr"

Is that possible?

D

Re: VBS waiting for program to finish by Alex

Alex
Fri Jul 18 11:21:43 CDT 2008

Change
objShell.Run "telnet " & myans

to this:

objShell.Run "telnet " & myans, 1, True

The second parameter (the 1) controls the window style and is only necessary
so we can specify the third parameter, which tells the Run method to wait
until the application exits before returning.

"hb21l6" <hb21l6@hotmail.com> wrote in message
news:8BF916D3-6402-4982-8418-F13217F8572D@microsoft.com...
> hello,
> I have this script that I use on a servicedesk.
>
> Basically it starts the Telnet service on a remote PC and then connects me
> to it.
>
> myans = Inputbox("Enter PC Name or IP address")
> Dim objShell
> Set objShell = CreateObject("WScript.Shell")
> objShell.Run "sc \\"& myans &" config tlntsvr start= auto"
> objShell.Run "sc \\"& myans &" start TlntSvr"
> objShell.Run "telnet " & myans
>
> 'objShell.Run "sc \\"& myans &" stop TlntSvr"
> 'WScript.Quit
> Set objShell =nothing
>
>
> What I want it to do is wait until the telnet program is closed my mysef
> then run the following bit of code.
>
> objShell.Run "sc \\"& myans &" stop TlntSvr"
>
> Is that possible?
>
> D


Re: VBS waiting for program to finish by mr_unreliable

mr_unreliable
Fri Jul 18 11:41:12 CDT 2008

hb21l6 wrote:
> Basically it starts the Telnet service on a remote PC and then connects
> me to it.
>
> What I want it to do is wait until the telnet program is closed my mysef
> then run the following bit of code.
>

hi hb2116,

Have you considered the "wshRemote" object?

If you use it to run a script remotely, then it has
the capability of providing a "status" property
(noTask, Running, Finished).

If interested, you can read more by searching the
wsh documentation for the page entitled:

"Status Property (WshRemote)"

cheers, jw
____________________________________________________________

You got questions? WE GOT ANSWERS!!! ..(but,
no guarantee the answers will be applicable to the questions)


Re: VBS waiting for program to finish by hb21l6

hb21l6
Sat Jul 19 05:56:57 CDT 2008


> hi hb2116,
>
> Have you considered the "wshRemote" object?
>
> If you use it to run a script remotely, then it has
> the capability of providing a "status" property
> (noTask, Running, Finished).
>
> If interested, you can read more by searching the
> wsh documentation for the page entitled:
>
> "Status Property (WshRemote)"
>
> cheers, jw
> ____________________________________________________________
>
> You got questions? WE GOT ANSWERS!!! ..(but,
> no guarantee the answers will be applicable to the questions)
>
>

cheers,
I'll take a look

Dave