Re: Mapping drives
- From: "Buddy Greenshield" <gcsbend-at-bendcable-dot-com>
- Date: Wed, 20 Apr 2005 02:25:29 -0700
Sorry for the delayed response... No, it won't map "T" twice (It can only be
mapped to one resource anyway). Look closer at the code.
The script enters the IF statement and first checks to see if "T" is already
in use. If so...
Next is checks to see if "T" is mapped to the correct share. In the first
case, it was correctly mapped and can exit the sub.
Else, "T" was in use, but not mapped to the correct share. So Remove "T" and
then remap it to the correct share, then exit the sub.
If "T" was not in use, then the script skips the IF statements and just maps
the drive and now you can exit the sub. Works every time!
Buddy G
"Dwight" <dwight@xxxxxxxxxxxxx> wrote in message
news:1113848308.201541.161350@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>
> Buddy Greenshield wrote:
> > If you're using vbscript to map the drives, first test to see if it's
> > already mapped to the correct share, if it is, continue. If it's not,
> remove
> > the mapping and remap. Use this code for each drive you need to map.
> >
> > Example:
> > Dim oNet, oDrives
> > Set oNet = WScript.CreateObject("WScript.Network")
> > Set oDrives = oNet.EnumNetworkDrives
> > For i = 0 to oDrives.Count - 1 Step 2
> > If oDrives.Item(i) = "T:" Then
> > If oDrives.Item(i+1) = "\\sbsComputer\ShareName" Then
> > Continue with your script here...all is well
> > Else
> > oNet.RemoveNetworkDrive "T:"
> > oNet.MapNetworkDrive "T:","\\sbsComputer\CorrectShareName"
> > Continue with your script...the mapping has been corrected
> > End If
> > End If
> > Next
> > oNet.MapNetworkDrive "T:","\\sbsComputer\CorrectShareName"
> > Continue with your script, It wasn't mapped, but now it is.
> >
> > Buddy G
> >
> >
> Won't this script map the T: drive twice?
>
> The MapNetworkDrive is issued twice if the maping is incorrect and once
> if it is correct.
>
.
- References:
- Mapping drives
- From: dwight
- RE: Mapping drives
- From: Joe K
- RE: Mapping drives
- From: dwight
- Re: Mapping drives
- From: Steve Stogrin
- Re: Mapping drives
- From: dwight
- Re: Mapping drives
- From: Buddy Greenshield
- Re: Mapping drives
- From: Dwight
- Mapping drives
- Prev by Date: Re: Internet Connection
- Next by Date: I can't install SBS after uninstalling
- Previous by thread: Re: Mapping drives
- Next by thread: Getting internal domain noticed to the outside world
- Index(es):
Relevant Pages
|