Curtis
Thu Jan 25 09:29:55 CST 2007
Thanks for the quick reply Ayush.
One other thing, is it possible to put in a further condition so if during
the loop it finds the G Drive has now mapped, it continues with the script
rather than looping until the 5 minutes are up?
Curtis.
==
"Ayush" <"ayushmaan.j[aatt]gmail.com"> wrote in message
news:%239IeK5IQHHA.320@TK2MSFTNGP06.phx.gbl...
> Replied to [Curtis Fray]s message :
>> Hi,
>>
>> I'm using the below script to map a drive:
>>
>> ======
>> Dim objNetwork
>>
>> Set objNetwork = CreateObject("Wscript.Network")
>> On Error Resume Next
>>
>> objNetwork.RemoveNetworkDrive "G:"
>> objNetwork.MapNetworkDrive "G:", "\\domain1dc1\test"
>> ======
>>
>> What I'd like to do is put in a loop command so it if it fails to map the
>> G drive (ie, the share isn't available at that time) it keeps trying
>> until it is successful. I'd also like to set this loop to time out after
>> 5mins if that's possible?
>>
>> Could someone show me how this is done?
>>
>
> ======
> Dim objNetwork
>
> Set objNetwork = CreateObject("Wscript.Network")
> On Error Resume Next
> objNetwork.RemoveNetworkDrive "G:"
> countr = 0
> Do Until countr=300000
> objNetwork.MapNetworkDrive "G:", "\\domain1dc1\test"
> Wscript.Sleep 1000 'Pause Script for 1 second
> countr = countr + 1
> Loop
>
> ======
>
>
>
> --
> ? Ayush
> -------------
> Search - www.Google.com | Wikipedia -
http://en.wikipedia.org
> Snip your long urls -
http://snipurl.com/
> -------------