Re: Mapping drives

Tech-Archive recommends: Fix windows errors by optimizing your registry



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


"dwight" <dwight@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:A1D90A17-6204-43FB-A2BE-1DF5E5685DDB@xxxxxxxxxxxxxxxx
>
>
> "Steve Stogrin" wrote:
>
> > use GPO I posted information about this over a year ago.
> >
> >
http://groups.google.ca/groups?hl=en&lr=&th=b244aab1080db64c&seekm=ezNu7kNPEHA.3020%40tk2msftngp13.phx.gbl&frame=off
> >
>
> That is how I'm currently doing it, based on your post. Just thought there
> might be an easier way.
>
> If a user already has that particular drive mapped, the user gets a
vbscript
> error when logging in. How does one correct that problem?
>
> Thanks.


.



Relevant Pages

  • Re: troubleshoot a script
    ... I see you use the memberOf attribute. ... ' map appropriate drives. ... The part of the script that will not work for the 3 ...
    (microsoft.public.scripting.vbscript)
  • Unable to remove remembered drives
    ... The script is completely finished and works perfectly if I ... It turned out that it couldn't map the drive for some ... appears I cant remove these remembered drives, ... Set fso = Createobject ...
    (microsoft.public.scripting.vbscript)
  • Drive Mapping Script Not working
    ... I have a script that maps drives based on a machines name here is a sample ... net use and map the share correctly net use reports the share to already be ...
    (microsoft.public.windows.server.scripting)
  • Re: User Independent Mapped Drive
    ... OU that runs a batch file to map the drives. ... server of where they're from. ... script, ...
    (microsoft.public.windows.server.networking)
  • Re: Issues mapping network drive via login script
    ... the scripts if they dont all connect cause they dont "understand" how to map ... The computer that is not mapping the drives - does it have any of those ... CD/DVDROMs in Disk Management so that my script could actually map the drive ... I have login scripts assigned to the domain users via the Profile ...
    (microsoft.public.windowsxp.general)