Announcement

Collapse
No announcement yet.

Mapped Network Drive Scripting problems

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Mapped Network Drive Scripting problems

    Hi,

    I'm having some trouble with a VB Logon script on windows 2000 that maps drives. My problem is the drives map fine the first time but every login after that windows 2000 workstations ask for the password even though it's provided in the script. here's how the script looks.
    Code:
    '####################################################
    Dim strUser
    Dim strPass
    
    strUser = "UserName"
    strPass = "Password"
    
    Set wshNetwork = CreateObject("WScript.Network")
        wshNetwork.MapNetworkDrive "P:", "\\Server\Apps",True,strUser,strPass
        wshNetwork.MapNetworkDrive "Q:", "\\Server\Images",True,strUser,strPass
    
    *tried this too...
         wshNetwork.MapNetworkDrive "P:", "\\Server\Apps",False,strUser,strPass
         wshNetwork.MapNetworkDrive "Q:", "\\Server\Images",False,strUser,strPass
    Wscript.Quit
    So how is there a way to get windows to remember the password or completey remove the connections so it new every time.

    I have also tried running this in the logoff script but it doesn't help.

    Code:
    wshNetwork.RemoveNetworkDrive "P:"
    wshNetwork.RemoveNetworkDrive "Q:"
    Any Suggestions?

    MS


    Edit Dumber, Wrapped Code Text arround script.
    Last edited by Dumber; 1st August 2006, 18:53.

  • #2
    Re: Mapped Network Drive Scripting problems

    Have you tried providing the username in DOMAIN\Username format?
    Server 2000 MCP
    Development: ASP, ASP.Net, PHP, VB, VB.Net, MySQL, MSSQL - Check out my blog http://tonyyeb.blogspot.com

    ** Remember to give credit where credit is due and leave reputation points sigpic where appropriate **

    Comment


    • #3
      Re: Mapped Network Drive Scripting problems

      Yes actually, That is how I was using it I just didn't put it in the post.

      This is what I have been doing to get around the password promting for now.
      It's messy but it works for now.

      Code:
      Dim RegPath
      Dim strKeyPath
      Dim strComputer
      Dim oReg
      
      Const HKEY_CURRENT_USER = &H80000001
      strComputer = "."
      Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
      RegPath = "Network\F,Network\P,Network\Q,Network\X"
      strKeyPath = Split(RegPath,",")
      
      oReg.DeleteKey HKEY_CURRENT_USER, strKeyPath(0)
      oReg.DeleteKey HKEY_CURRENT_USER, strKeyPath(1)
      oReg.DeleteKey HKEY_CURRENT_USER, strKeyPath(2)
      oReg.DeleteKey HKEY_CURRENT_USER, strKeyPath(3)
      MS
      Last edited by Mseeley; 3rd August 2006, 17:03.

      Comment

      Working...
      X