Re: Can you create a timed loop?



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
: >
: >
: >



.



Relevant Pages

  • Re: Net use command
    ... Byron Kendrick wrote: ... All mapping in the ... > like to be able to write a script to change the network drives. ... Let's say for example you want to map drive letter P: ...
    (microsoft.public.win2000.general)
  • Re: Really stupid mapped drive question
    ... Using the /persistent switch at the same time as mapping drives ... weren't able to map the drive off of the startup script I was using. ... the machines with the problem and machines without the problem is the ...
    (microsoft.public.windowsxp.general)
  • Re: Login Script group membership
    ... The script sees the global mappings, ... The first ifmember will return an error code indicating whether or not the ... The final block avoids mapping I: if the user is not a member of "group ... if errorlevel 1 set LS_Error=%LS_Error% I ...
    (microsoft.public.windows.server.scripting)
  • Re: how to add a whildcard appliation mapping in IIS programmatically?
    ... Microsoft Online Support ... | Subject: Re: how to add a whildcard appliation mapping in IIS ... |> For the programmatically register script extension mapping in IIS, ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Re: Can you create a timed loop?
    ... If I put in bogus server names, I get the same result as you. ... on and not mapping to a non-existing share? ... That's what this script does. ... I created a logon script which tries to map to 12 bogus shares ...
    (microsoft.public.scripting.vbscript)

Loading