Re: Logon Drive Mapping script
From: Will S (dontpanic1.nospam_at_hotmail.nospam.com.nospam)
Date: 01/24/05
- Next message: Erin0: "Re: Add SMTP address and set as primary"
- Previous message: bearbaba: "Re: Windows hot fix installation problem"
- In reply to: Torgeir Bakken \(MVP\): "Re: Logon Drive Mapping script"
- Next in thread: Will S: "Re: Logon Drive Mapping script"
- Reply: Will S: "Re: Logon Drive Mapping script"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 24 Jan 2005 06:06:51 -0800
This fix seems to work pretty good...but I'm seeing inconsistent
behavior where it sometimes will not rename the display name to what
the share is currently mapped to.
Is there a limit as to the number of drive descriptions it can adjust
or some better way to use the subroutine for scripts that potentially
map multiple drives?
Thanks,
Will
Torgeir Bakken (MVP) wrote:
> Timothy Hasty wrote:
>
> > Correction *---*
> >
> > This script will remap to the correct drive.
> >
> > Here is the problem.
> >
> > Example:
> >
> > Drive y is mapped to \\dc2\h
> >
> > when I run the script it is suppose to remap the drive to \\data\f
> >
> > I run the script. In my computer it still looks like y is mapped to
> > \\dc2\h
> >
> > If I open the Y Drive it opens the correct \\data\f path.
> >
> > But it still lists in My Computer as y: H on DC2
> Hi
>
> Very strange, and I don't have a direct solution for you.
>
> But a workaround is to add the sub-routine AdjustDriveDescription
> listed below to your script, and when you are finished mapping the
> drives, make a callout to the sub like this:
>
>
> ....
>
> AdjustDriveDescription
>
> ' Clean up.
> Set objGroupList = Nothing
> Set objUser = Nothing
> Set objNetwork = Nothing
> ...
>
>
> '--------------------8<----------------------
>
> Sub AdjustDriveDescription
>
> On Error Resume Next
> Dim oShellApp, oWshNet, oDrives, i, sDrive, sDriveDesc
> Dim sUNCPath, aUNCPath, sNewDriveDesc, sLastElement
>
> Set oShellApp = CreateObject("Shell.Application")
> Set oWshNet = CreateObject("WScript.Network")
> Set oDrives = oWshNet.EnumNetworkDrives
>
> For i = 0 to oDrives.Count - 1 Step 2
>
> sDrive = oDrives.Item(i) & "\"
> sDriveDesc = oShellApp.NameSpace(sDrive).Self.Name
>
> ' remove the \\ in front
> sUNCPath = LCase(Mid(oDrives.Item(i+1), 3))
> aUNCPath = Split(sUNCPath, "\")
>
> If UBound(aUNCPath) > 0 Then
> sLastElement = aUNCPath(UBound(aUNCPath))
> sNewDriveDesc = sLastElement & " on '" _
> & Left(sUNCPath, Len(sUNCPath) - Len(sLastElement) - 1) &
> "'"
>
> oShellApp.NameSpace(sDrive).Self.Name = sNewDriveDesc
>
> End If
> Next
> On Error Goto 0
> End Sub
>
>
> '--------------------8<----------------------
- Next message: Erin0: "Re: Add SMTP address and set as primary"
- Previous message: bearbaba: "Re: Windows hot fix installation problem"
- In reply to: Torgeir Bakken \(MVP\): "Re: Logon Drive Mapping script"
- Next in thread: Will S: "Re: Logon Drive Mapping script"
- Reply: Will S: "Re: Logon Drive Mapping script"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|