Re: Can you create a timed loop?
- From: Chris Moller <chrisdmoller@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 10 Aug 2006 12:07:02 -0700
Walter,
Suggestion 1 is not the case as I am actually testing this with 3 mappings
to a server that has just been decommed but the DNS entries have not been
cleaned up.
It calls the mapping function 3 times, and I have debugging code to show
when it is called and when it finishes timing out.
I tried the second suggestion, and got the same results. It is not
terminating the attempt to map the network drive early.
Any other suggestions?
Thanks,
-Chris
"Walter Zackery" wrote:
"Chris Moller" <chrisdmoller@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message.
news:6F2714AE-545F-48A2-B3FB-44CC77E1A16C@xxxxxxxxxxxxxxxx
: Walter,
:
: I did as you said, called another script and passed the Drive, Mapping
: information as parameters, set the wscript.timeout to 10 seconds, and ran
it.
: First I ran it with a sleep value of 30 seconds and no other functionality
to
: verify that the script was terminating after 10 seconds. I also verified
that
: I was receiving the passed information correctly and then added in the
: mapping function.
:
: Result: I am getting the same 45-50 timeout period and the wscript.timeout
: at the start of the script is not killing the script early. Is there a
force
: option to kill this thread, or is there another way to achieve this early
: termination? It seems the mapnetworkdrive operation has a higher priority
: that the script.
:
Suggestion #1:
There's a very slight possibility that the script had already terminated
after it issued the call to MapNetworkDrive without an error, since that was
the last command. In that case, WScript.Timeout would be meaningless. To
test this, you can try adding a do-nothing line at the end, something like
WScript.Sleep 1, to ensure that the script continues to run.
Suggestion #2:
If the above doesn't work, then you may need to do something like this:
TheTime = Now
Set Exec = oShell.Exec(cscript //nologo
C:\Temp-LocalWorking\2006_08_09\CALLED-AbortMappingEarly.vbs " & Drive & " "
& Mapping)
While Exec.Status = 0 Or DateDiff("s",TheTime,Now) < 10
WScript.Sleep 50
Wend
If Exec.Status = 0 Then Exec.Terminate
If neither one of these approaches work, then it's probably a problem for
the networking gurus around here to tackle.
: "Walter Zackery" wrote:
:
: > I think that you'll have to create a separate file with the following
lines:
: >
: > WScript.Timeout = 10
: > CreateObject("WScript.Network").MapNetworkDrive Drive,Share
: >
: > You would then call this script from your logon script using either the
Run
: > or Exec methods, passing the drive and share names as parameters.
: >
: > "Chris Moller" <chrisdmoller@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
: > news:5A2B0DEC-73B7-402D-BDC5-2FBA06768A0B@xxxxxxxxxxxxxxxx
: > :I am attempting to shorten the default timeout
: > : period when mapping a network drive via a
: > : logon script (useful when the server is down)
: > : from the default of 45-50 seconds to 10
: > : seconds. Users with a dozen or more mappings
: > : affected like this can end up waiting 10+
: > : minutes for the logon script to complete.
: > :
: > : Does anyone know a way to do this in VBScript?
: > : (NOTE: I don't want to go the one size fits all
: > : setting, a timeout on the whole script via
: > : Properties > Script > Stop script after specified
: > : number of seconds.)
: > :
: > : i.e.
: > : Do (loop for up to the next 10 seconds while
: > : waiting for this operation to complete)
: > : objNet.MapNetworkDrive L:,\\srvname\share
: > : Loop
: > :
: > : -Chris
: >
: >
: >
- References:
- Re: Can you create a timed loop?
- From: Walter Zackery
- Re: Can you create a timed loop?
- From: Chris Moller
- Re: Can you create a timed loop?
- From: Walter Zackery
- Re: Can you create a timed loop?
- Prev by Date: Re: Can you create a timed loop?
- Next by Date: Re: Setting HTML based wallpaper?
- Previous by thread: Re: Can you create a timed loop?
- Next by thread: Re: Can you create a timed loop?
- Index(es):
Relevant Pages
|
Loading