Please Read: Significant Update Planned, Migrating Forum Software This Month

See more
See less

Trouble mapping network drive at startup

  • Filter
  • Time
  • Show
Clear All
new posts

  • Trouble mapping network drive at startup


    I am wanting to have a batch file run that maps a network drive whenever the computer starts, not when a domain user logs in. To do this, I made a GPO here: Computer Configuration/Windows Settings/Scripts/Startup.

    The reason I want to do it this way is so that if a local administrator logs in, he/she will have the network drive mapped for him/her.

    The script looks like this:

    NET USE z: \\\software\contentwatch /user:student CAT123

    When the script runs, I can see in the script command window that it says "command completed successfully" when the drive is mapped.

    The problem is, after logging in as local administrator and look at the mapped drives, I can see the Z: drive is mapped but when I click on it, it says: Z:\ is not accessible. Logon failure: unknown username or bad password.

    I know I am using the correct user name and password. Any suggestions?

    Thanks a lot.

  • #2
    Re: Trouble mapping network drive at startup

    Please elaborate further. You mention that you want this script run only for the local administrators and not the domain users. By definition local administrators can be local accounts on the computers/servers or domain users added to the "Local Administrators" group on the device.

    The account you mentioned student CAT123, is this a local account or domain user account? or does the resource (share) have share permissions assigned to the user accounts you are logging in as?
    Last edited by saqib1972; 5th May 2009, 16:06. Reason: spell check


    • #3
      Re: Trouble mapping network drive at startup

      Mapped drives are user settings it cannot be globally mapped by a computer startupscript.

      Run the batch as a logonscript, check the user's memberschip for the local Administrators group and do the mapping.

      quick sample:
      :: Note,
      :: The drive letter going to be used should be available
      :: on the client computer.
      :: Furthermore,
      :: Multiple connections to a server or shared resource
      :: by the same user, using more than one user name, are
      :: not allowed. You should disconnect all previous
      :: connections to the server or shared resource.
      @echo off
      Set "NoAdmin="
      2>nul (Net Use Z: /D /Y)
      FOR /F "tokens=*" %%* IN (
       'WMIC.exe quit 2^>^&1 1^>NUL'
       ) DO Set "NoAdmin=True"
      If Not Defined NoAdmin (
         echo User is a local admin
         Net use Z: "\\\software\contentwatch" /PERSISTENT:NO /User:"domainname\student" "CAT123"

      This posting is provided "AS IS" with no warranties, and confers no rights.


      ** Remember to give credit where credit's due **
      and leave Reputation Points for meaningful posts


      • #4
        Re: Trouble mapping network drive at startup

        This drive needs to be mapped when a local user logs in (not part of the domain). When I push CTRL+ALT+DEL to logon I change the third option to (this computer) to logon. I am not logging on to the domain, I am logging on to the local computer and I need to have a drive automatically mapped without touching each computer.

        Is this possible?



        • #5
          Re: Trouble mapping network drive at startup

          You could try using group policy (computer settings) to run a batch file which would copy your login script to the startup folder for the local administrator account.


          • #6
            Re: Trouble mapping network drive at startup

            The shared resource must exist in the same workgroup/Domain for a seemless access, otherwise you could run into authentication issues which I belive is the original issue to begin with.