+ Post New Thread
Page 1 of 2 12 LastLast
Results 1 to 15 of 20
Windows Thread, Group Policy Mapped Drive Script - Not Working in Technical; Hey Everyone, This has been a problem for going on a year now. I've done a lot of research, but ...
  1. #1

    Join Date
    Apr 2008
    Posts
    7
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Unhappy Group Policy Mapped Drive Script - Not Working

    Hey Everyone,

    This has been a problem for going on a year now. I've done a lot of research, but still can't find a solution to my problem. Here's the details:

    We have a network with a little over 100 computer users. We have 5 sites and 5 DC's. We have a script file that maps drives to our servers (see attached at bottom). The file is attached to GPO's at user logon. The odd thing is, the script will run on about half of the computers and the other half they will not. I've linked these GPO's to the proper OUs. I have the GPO's applied to all "Authenticated Users". I set the Default Domain Policy to Enforced and set the Script Policy Processing to Enabled and selected the allow script policy to run over slow connections and process policy even if no changes have occurred. I also changed the value of the slow link detection to 0, which should have disabled it. I have the script in the right location on the server. I've tried gpupdate /force on the computers that don't have the script run. I added a system pause in the script for 20 seconds to ensure the network connections have been fully initialized after logon, before trying to map the drives. I have absolutely no clue what to try next. Can someone please help?

    Script File:

    ' mapdrive.vbs
    ' VBScript to map network drives
    ' -------------------------------------------'
    '
    Option Explicit
    Dim objNetwork, strDrive, objShell, objUNC
    Dim strRemotePath1, strDriveLetter1, strNewName1, strRemotePath2, strDriveLetter2, strNewName2, strRemotePath3, strDriveLetter3, strNewName3, strRemotePath4, strDriveLetter4, strNewName4, strRemotePath5, strDriveLetter5, strNewName5, strRemotePath6, strDriveLetter6, strNewName6
    Dim bForce, bUpdateProfile, strRemDriveLetter

    WSCript.Sleep 20000


    ' This section removes any existing mapped drives, begining at the letter "J:"'
    ' if no drive exists, the script moves to the next drive letter'
    ' --------------------------------------------------------------------------- '
    strRemDriveLetter = "G:"
    err.number = vbempty
    Set objNetwork = CreateObject("WScript.Network")
    ' Removes strRemDriveLetter, with bForce, pUpdate Profile
    On Error Resume Next
    objNetwork.RemoveNetworkDrive strRemDriveLetter, _
    bforce, bUpdateProfile

    strRemDriveLetter = "H:"
    err.number = vbempty
    Set objNetwork = CreateObject("WScript.Network")
    ' Removes strRemDriveLetter, with bForce, pUpdate Profile
    On Error Resume Next
    objNetwork.RemoveNetworkDrive strRemDriveLetter, _
    bforce, bUpdateProfile

    strRemDriveLetter = "I:"
    err.number = vbempty
    Set objNetwork = CreateObject("WScript.Network")
    ' Removes strRemDriveLetter, with bForce, pUpdate Profile
    On Error Resume Next
    objNetwork.RemoveNetworkDrive strRemDriveLetter, _
    bforce, bUpdateProfile

    strRemDriveLetter = "J:"
    err.number = vbempty
    Set objNetwork = CreateObject("WScript.Network")
    ' Removes strRemDriveLetter, with bForce, pUpdate Profile
    On Error Resume Next
    objNetwork.RemoveNetworkDrive strRemDriveLetter, _
    bforce, bUpdateProfile

    strRemDriveLetter = "K:"
    err.number = vbempty
    Set objNetwork = CreateObject("WScript.Network")
    ' Removes strRemDriveLetter, with bForce, pUpdate Profile
    On Error Resume Next
    objNetwork.RemoveNetworkDrive strRemDriveLetter, _
    bforce, bUpdateProfile

    strRemDriveLetter = "L:"
    err.number = vbempty
    Set objNetwork = CreateObject("WScript.Network")
    ' Removes strRemDriveLetter, with bForce, pUpdate Profile
    On Error Resume Next
    objNetwork.RemoveNetworkDrive strRemDriveLetter, _
    bforce, bUpdateProfile

    strRemDriveLetter = "M:"
    err.number = vbempty
    Set objNetwork = CreateObject("WScript.Network")
    ' Removes strRemDriveLetter, with bForce, pUpdate Profile
    On Error Resume Next
    objNetwork.RemoveNetworkDrive strRemDriveLetter, _
    bforce, bUpdateProfile

    strRemDriveLetter = "N:"
    err.number = vbempty
    Set objNetwork = CreateObject("WScript.Network")
    ' Removes strRemDriveLetter, with bForce, pUpdate Profile
    On Error Resume Next
    objNetwork.RemoveNetworkDrive strRemDriveLetter, _
    bforce, bUpdateProfile

    strRemDriveLetter = "O:"
    err.number = vbempty
    Set objNetwork = CreateObject("WScript.Network")
    ' Removes strRemDriveLetter, with bForce, pUpdate Profile
    On Error Resume Next
    objNetwork.RemoveNetworkDrive strRemDriveLetter, _
    bforce, bUpdateProfile

    strRemDriveLetter = "P:"
    err.number = vbempty
    Set objNetwork = CreateObject("WScript.Network")
    ' Removes strRemDriveLetter, with bForce, pUpdate Profile
    On Error Resume Next
    objNetwork.RemoveNetworkDrive strRemDriveLetter, _
    bforce, bUpdateProfile

    strRemDriveLetter = "Q:"
    err.number = vbempty
    Set objNetwork = CreateObject("WScript.Network")
    ' Removes strRemDriveLetter, with bForce, pUpdate Profile
    On Error Resume Next
    objNetwork.RemoveNetworkDrive strRemDriveLetter, _
    bforce, bUpdateProfile

    strRemDriveLetter = "R:"
    err.number = vbempty
    Set objNetwork = CreateObject("WScript.Network")
    ' Removes strRemDriveLetter, with bForce, pUpdate Profile
    On Error Resume Next
    objNetwork.RemoveNetworkDrive strRemDriveLetter, _
    bforce, bUpdateProfile

    strRemDriveLetter = "S:"
    err.number = vbempty
    Set objNetwork = CreateObject("WScript.Network")
    ' Removes strRemDriveLetter, with bForce, pUpdate Profile
    On Error Resume Next
    objNetwork.RemoveNetworkDrive strRemDriveLetter, _
    bforce, bUpdateProfile

    strRemDriveLetter = "T:"
    err.number = vbempty
    Set objNetwork = CreateObject("WScript.Network")
    ' Removes strRemDriveLetter, with bForce, pUpdate Profile
    On Error Resume Next
    objNetwork.RemoveNetworkDrive strRemDriveLetter, _
    bforce, bUpdateProfile

    strRemDriveLetter = "U:"
    err.number = vbempty
    Set objNetwork = CreateObject("WScript.Network")
    ' Removes strRemDriveLetter, with bForce, pUpdate Profile
    On Error Resume Next
    objNetwork.RemoveNetworkDrive strRemDriveLetter, _
    bforce, bUpdateProfile

    strRemDriveLetter = "V:"
    err.number = vbempty
    Set objNetwork = CreateObject("WScript.Network")
    ' Removes strRemDriveLetter, with bForce, pUpdate Profile
    On Error Resume Next
    objNetwork.RemoveNetworkDrive strRemDriveLetter, _
    bforce, bUpdateProfile

    strRemDriveLetter = "W:"
    err.number = vbempty
    Set objNetwork = CreateObject("WScript.Network")
    ' Removes strRemDriveLetter, with bForce, pUpdate Profile
    On Error Resume Next
    objNetwork.RemoveNetworkDrive strRemDriveLetter, _
    bforce, bUpdateProfile

    strRemDriveLetter = "X:"
    err.number = vbempty
    Set objNetwork = CreateObject("WScript.Network")
    ' Removes strRemDriveLetter, with bForce, pUpdate Profile
    On Error Resume Next
    objNetwork.RemoveNetworkDrive strRemDriveLetter, _
    bforce, bUpdateProfile

    strRemDriveLetter = "Y:"
    err.number = vbempty
    Set objNetwork = CreateObject("WScript.Network")
    ' Removes strRemDriveLetter, with bForce, pUpdate Profile
    On Error Resume Next
    objNetwork.RemoveNetworkDrive strRemDriveLetter, _
    bforce, bUpdateProfile

    strRemDriveLetter = "Z:"
    err.number = vbempty
    Set objNetwork = CreateObject("WScript.Network")
    ' Removes strRemDriveLetter, with bForce, pUpdate Profile
    On Error Resume Next
    objNetwork.RemoveNetworkDrive strRemDriveLetter, _
    bforce, bUpdateProfile


    ' This section of the script maps the desired drives to directories '
    ' ----------------------------------------------------------------- '

    strDriveLetter1 = "R:"
    strRemotePath1 = "\\reg-fs1\thrasher"
    strNewName1 = "REG-Clarksburg \ General"
    strDriveLetter2 = "M:"
    strRemotePath2 = "\\reg-thrashenv1\thrashenv"
    strNewName2 = "REG-Charleston \ General"
    strDriveLetter3 = "N:"
    strRemotePath3 = "\\reg-Potomac1\potomac"
    strNewName3 = "REG-Oakland \ General"
    strDriveLetter4 = "O:"
    strRemotePath4 = "\\reg-Berkeley1\berkeley"
    strNewName4 = "REG-Martinsburg \ General"
    strDriveLetter5 = "P:"
    strRemotePath5 = "\\reg-Pentree1\pentree"
    strNewName5 = "REG-Pentree \ General"
    strDriveLetter6 = "Q:"
    strRemotePath6 = "\\reg-fs1\thrasher\acct"
    strNewName6 = "REG-Clarksburg \ Accounting"


    ' Section to map the network drive
    Set objNetwork = CreateObject("WScript.Network")
    objNetwork.MapNetworkDrive strDriveLetter1, strRemotePath1
    Set objNetwork = CreateObject("WScript.Network")
    objNetwork.MapNetworkDrive strDriveLetter2, strRemotePath2
    Set objNetwork = CreateObject("WScript.Network")
    objNetwork.MapNetworkDrive strDriveLetter3, strRemotePath3
    Set objNetwork = CreateObject("WScript.Network")
    objNetwork.MapNetworkDrive strDriveLetter4, strRemotePath4
    Set objNetwork = CreateObject("WScript.Network")
    objNetwork.MapNetworkDrive strDriveLetter5, strRemotePath5
    Set objNetwork = CreateObject("WScript.Network")
    objNetwork.MapNetworkDrive strDriveLetter6, strRemotePath6


    ' Section which (re)names the Mapped Drive
    ' To undo the naming, editing the registry is required
    ' launch regedit; the value turns up under MountPoints. The full path is:
    ' HKCU, Software, Microsoft, Windows, CurrentVersion, Explorer, MountPoints2,
    ' The Reg_SZ was called _LabelFromReg. My advice is to just delete the value - leave it blank.
    ' The result will be that future drive mapping will revert to the traditional style of mapping.
    Set objShell = CreateObject("Shell.Application")
    objShell.NameSpace(strDriveLetter1).Self.Name = strNewName1
    Set objShell = CreateObject("Shell.Application")
    objShell.NameSpace(strDriveLetter2).Self.Name = strNewName2
    Set objShell = CreateObject("Shell.Application")
    objShell.NameSpace(strDriveLetter3).Self.Name = strNewName3
    Set objShell = CreateObject("Shell.Application")
    objShell.NameSpace(strDriveLetter4).Self.Name = strNewName4
    Set objShell = CreateObject("Shell.Application")
    objShell.NameSpace(strDriveLetter5).Self.Name = strNewName5
    Set objShell = CreateObject("Shell.Application")
    objShell.NameSpace(strDriveLetter6).Self.Name = strNewName6


    ' Echo for check
    Wscript.Echo "Mapped drive '" & strNewName1 & "' has been changed from L: to " & strDriveLetter1
    WScript.Quit

  2. #2
    box_l's Avatar
    Join Date
    May 2007
    Location
    Herefordshire
    Posts
    439
    Thank Post
    79
    Thanked 95 Times in 79 Posts
    Rep Power
    63
    Hi,

    How do you know the script does not run?

    it runs silently, yes? maybe you need to put in something visual to prove that it runs or not.

    Code:
    MsgBox "Yup it runs!"
    perhaps manually map some drives and see if the script removes them.

    i am guessing that the script runs but cannot map the drives, cannot see the path?

    BoX

  3. #3

    Join Date
    Apr 2008
    Posts
    7
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Thanks for replying.
    If you'll note the bottom of the script file, I have a dialog box pop up with a message.

    The users who don't have their drives mapped also don't get the dialog box.
    Thanks

  4. #4

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    16,319
    Thank Post
    902
    Thanked 1,799 Times in 1,550 Posts
    Blog Entries
    12
    Rep Power
    466
    When you run the script manually does it work?

  5. #5
    box_l's Avatar
    Join Date
    May 2007
    Location
    Herefordshire
    Posts
    439
    Thank Post
    79
    Thanked 95 Times in 79 Posts
    Rep Power
    63
    doh!
    my bad for not reading to the end.

  6. #6

    Join Date
    Apr 2008
    Posts
    7
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Yes. The script will actually deploy to about half of the computers with no problems.

  7. #7

    Join Date
    Apr 2008
    Posts
    7
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Quote Originally Posted by box_l View Post
    doh!
    my bad for not reading to the end.
    No problem, I'm just happy to know people are trying to help
    This has been a major problem for a while.

  8. #8

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    16,319
    Thank Post
    902
    Thanked 1,799 Times in 1,550 Posts
    Blog Entries
    12
    Rep Power
    466
    Quote Originally Posted by ctote View Post
    Yes. The script will actually deploy to about half of the computers with no problems.

    The ones it works on, are those computers older than the others?

  9. #9

    Join Date
    Apr 2008
    Posts
    7
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    I'm not sure what you mean by 'older ones'

    All computers are running XP PRO SP2.

  10. #10

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    16,319
    Thank Post
    902
    Thanked 1,799 Times in 1,550 Posts
    Blog Entries
    12
    Rep Power
    466
    I mean hardware specifications. The computers is does work on, are the specifications of those lower than the ones that don’t work?

  11. #11
    gaz350's Avatar
    Join Date
    Jul 2007
    Location
    Rutland, east.leicestershire :P
    Posts
    579
    Thank Post
    47
    Thanked 49 Times in 41 Posts
    Rep Power
    28
    Are all the machines that dont work in the same ou? or are they spread across all OU's?

    I've had a few issues on old systems that wouldn't pickup GPO's untill i did
    ipconfig /flushdns
    then ran gpupdate /force

    also make sure your logged in as a domain admin not a local user when doing gpupdate

  12. #12
    box_l's Avatar
    Join Date
    May 2007
    Location
    Herefordshire
    Posts
    439
    Thank Post
    79
    Thanked 95 Times in 79 Posts
    Rep Power
    63
    can you try calling them from a login script instead of from the group policy?

    maybe some machines need a longer delay due to different NICs or have a slower connection.

  13. #13

    SYNACK's Avatar
    Join Date
    Oct 2007
    Posts
    11,270
    Thank Post
    884
    Thanked 2,747 Times in 2,321 Posts
    Blog Entries
    11
    Rep Power
    785
    If you deploy any software by MSI does it also have issues with these machines. If so it could be windows not waiting for the cards to be fully connected and procesding without applying network configuration stuff. There are two fixes for this the first is to apply this registery change which is recommended here.

    The next is to make sure that Spanning tree protocol - Wikipedia, the free encyclopedia is set up to only have a short delay for all client computer ports because this also causes windows to go on ahead when it gets impatient.

  14. #14

    Join Date
    Apr 2008
    Posts
    7
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Hey guys thanks for the replies!

    The problem seems to occur on both old and new computers, but mainly the older ones.

    Yes, they're in the same OU and yes, I've had a tech logged in as a domain admin while doing gpupdate /force. I'll try the ipconfig /flushdns

    I've disabled the slow link detection, so I don't think slow connections would be causing the problem... not sure though. I'll try loading the script via AD

    All MSI packages deploy fine. In fact, I think all computer settings apply to all computers, but the user settings (where i have the logon script) doesn't get applied to some.

    Thanks guys

  15. #15

    Join Date
    Apr 2008
    Posts
    7
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Adding the script to the "logon script" section in AD seems to work fine. However, this isn't a viable option for all 50 employees, as it will take too long to add the file to each user it's not working for. Any other ideas?



SHARE:
+ Post New Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. Mapped drive dropping
    By d4476m in forum Windows
    Replies: 12
    Last Post: 11th February 2008, 02:03 PM
  2. Citrix Mapped Drive error
    By paul in forum Thin Client and Virtual Machines
    Replies: 4
    Last Post: 8th November 2007, 03:29 PM
  3. Quota on mapped drive?
    By ozydave in forum Network and Classroom Management
    Replies: 2
    Last Post: 13th June 2007, 03:13 PM
  4. Share a mapped drive
    By Samson in forum Wireless Networks
    Replies: 4
    Last Post: 3rd May 2007, 03:35 PM
  5. Replies: 21
    Last Post: 11th July 2006, 08:37 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •