locked
Logon Script to Map a Drive Gives Error RRS feed

  • Question

  • Hello, I am running 2003 Server and running a logon script to map a drive on users by using Group Policy. It is a simple VB Script. I have Windows 7 Clients and the drive maps succesfully, however I get an error massage that states "The Local Device Name Is Already In Use". It acts as if the script is running twice. Any Ideas?

     

    Thanks!

    Wednesday, July 13, 2011 1:45 PM

Answers

  • I have an example VBScript logon script linked here that should help:

    http://www.rlmueller.net/Logon3.htm

    This logon script has features you may not need, but it has a MapDrive function for mapping drives. This function traps the possible error when the drive is mapped. If an error is raised, it attempts to remove any existing mapping (the most likely cause), then makes a second attempt. Only if this second attempt fails does the function return False (so the main program can take whatever action is required, like alerting the user). Also note that when the mapping is removed, two optional parameters are provided. The first removes the mapping even if is in use. The second ensures the mapping is no longer persistent.

     


    Richard Mueller - MVP Directory Services
    • Marked as answer by IamMred Saturday, July 16, 2011 6:11 AM
    Wednesday, July 13, 2011 2:38 PM

All replies

  • Sounds like you need to make your code a bit more robust.  It could be that the drive is persistent on reboot. Take a look here http://haripotter.wordpress.com/2008/08/05/how-to-map-a-network-drive-using-vbscript/ (First hit on Google) it has a bit of error checking to make sure the drive is not already mapped.

    Send us some code snippets and we can help you further.

     

    Wednesday, July 13, 2011 1:54 PM
  • I have an example VBScript logon script linked here that should help:

    http://www.rlmueller.net/Logon3.htm

    This logon script has features you may not need, but it has a MapDrive function for mapping drives. This function traps the possible error when the drive is mapped. If an error is raised, it attempts to remove any existing mapping (the most likely cause), then makes a second attempt. Only if this second attempt fails does the function return False (so the main program can take whatever action is required, like alerting the user). Also note that when the mapping is removed, two optional parameters are provided. The first removes the mapping even if is in use. The second ensures the mapping is no longer persistent.

     


    Richard Mueller - MVP Directory Services
    • Marked as answer by IamMred Saturday, July 16, 2011 6:11 AM
    Wednesday, July 13, 2011 2:38 PM