I administer a hospital network using a Win2003 domain. I have a requirement
to also provide service for some applications to medical offices that are not
part of my domain. Most of these offices connect to my domain using either a
client or a site-to-site VPN.

To connect to a recent deployed application I wrote a VB script that maps a
drive then calls the application. Problem is that sometimes the application
starts before the drive is mapped. Some of the VPN connections are slow and
it may take 30 secs or more to get the drive mapped. When this happens the
application fails to run.

How can I change my script so that the application is not called until the
mapping is successful?

My script follows.

'***********************************************************************
'Script: HealthPort_Map
'This script maps a drive for healthport then calls the application
'************************************************************************

On Error Resume Next

Dim objNetwork, objShell

Set objNetwork = CreateObject("WScript.Network")objNetwork.MapNetworkDrive
"Z:", "\\Nazgul\Healthimages",,"NVh1\password"

Set objShell = WScript.CreateObject("WScript.Shell")
ObjShell.Run "C:\HP.lnk", 1, True
--

Re: Mapping Problem by joseomjr

joseomjr
Thu Jan 25 21:10:00 CST 2007

Maybe put a loop in there

On Error Resume Next

Dim objNetwork, objShell, objFSO

Set objShell = CreateObject("WScript.Shell")
Set objNetwork = CreateObject("WScript.Network")
Set objFSO = CreateObject("Scripting.FileSystemObject")

objNetwork.MapNetworkDrive "Z:",
"\\Nazgul\Healthimages",,"NVh1\password"
Do Until objFSO.DriveExists("Z:") ' or maybe
objFSO.FileExists("Z:\yourapp.exe")
WScript.Sleep 3000
Loop
ObjShell.Run "C:\HP.lnk", 1, True

On Jan 25, 5:58 pm, mwebb <m...@discussions.microsoft.com> wrote:
> I administer a hospital network using a Win2003 domain. I have a requirement
> to also provide service for some applications to medical offices that are not
> part of my domain. Most of these offices connect to my domain using either a
> client or a site-to-site VPN.
>
> To connect to a recent deployed application I wrote a VB script that maps a
> drive then calls the application. Problem is that sometimes the application
> starts before the drive is mapped. Some of the VPN connections are slow and
> it may take 30 secs or more to get the drive mapped. When this happens the
> application fails to run.
>
> How can I change my script so that the application is not called until the
> mapping is successful?
>
> My script follows.
>
> '***********************************************************************
> 'Script: HealthPort_Map
> 'This script maps a drive for healthport then calls the application
> '************************************************************************
>
> On Error Resume Next
>
> Dim objNetwork, objShell
>
> Set objNetwork = CreateObject("WScript.Network")objNetwork.MapNetworkDrive
> "Z:", "\\Nazgul\Healthimages",,"NVh1\password"
>
> Set objShell = WScript.CreateObject("WScript.Shell")
> ObjShell.Run "C:\HP.lnk", 1, True
> --


Re: Mapping Problem by Richard

Richard
Fri Jan 26 11:37:28 CST 2007

I have never heard of a case where script execution continues before the
MapNetworkDrive method has completed the mapping. However, I would recommend
removing "On Error Resume Next". This statement has no purpose here except
to make troubleshooting impossible. Especially in a logon script, asking the
interpreter to ignore all errors makes little sense.

--
Richard
Microsoft MVP Scripting and ADSI
Hilltop Lab web site - http://www.rlmueller.net
--

<joseomjr@gmail.com> wrote in message
news:1169781000.047681.124710@k78g2000cwa.googlegroups.com...
> Maybe put a loop in there
>
> On Error Resume Next
>
> Dim objNetwork, objShell, objFSO
>
> Set objShell = CreateObject("WScript.Shell")
> Set objNetwork = CreateObject("WScript.Network")
> Set objFSO = CreateObject("Scripting.FileSystemObject")
>
> objNetwork.MapNetworkDrive "Z:",
> "\\Nazgul\Healthimages",,"NVh1\password"
> Do Until objFSO.DriveExists("Z:") ' or maybe
> objFSO.FileExists("Z:\yourapp.exe")
> WScript.Sleep 3000
> Loop
> ObjShell.Run "C:\HP.lnk", 1, True
>
> On Jan 25, 5:58 pm, mwebb <m...@discussions.microsoft.com> wrote:
> > I administer a hospital network using a Win2003 domain. I have a
requirement
> > to also provide service for some applications to medical offices that
are not
> > part of my domain. Most of these offices connect to my domain using
either a
> > client or a site-to-site VPN.
> >
> > To connect to a recent deployed application I wrote a VB script that
maps a
> > drive then calls the application. Problem is that sometimes the
application
> > starts before the drive is mapped. Some of the VPN connections are slow
and
> > it may take 30 secs or more to get the drive mapped. When this happens
the
> > application fails to run.
> >
> > How can I change my script so that the application is not called until
the
> > mapping is successful?
> >
> > My script follows.
> >
> > '***********************************************************************
> > 'Script: HealthPort_Map
> > 'This script maps a drive for healthport then calls the application
> >
'************************************************************************
> >
> > On Error Resume Next
> >
> > Dim objNetwork, objShell
> >
> > Set objNetwork =
CreateObject("WScript.Network")objNetwork.MapNetworkDrive
> > "Z:", "\\Nazgul\Healthimages",,"NVh1\password"
> >
> > Set objShell = WScript.CreateObject("WScript.Shell")
> > ObjShell.Run "C:\HP.lnk", 1, True
> > --
>