Net Use Batch File Deployment

Hello there,

I have a batch file I am trying to deploy. The file looks like this:

net use * "\\server\share" /p:yes

I am simply trying to map a network drive as you can see. The batch file is located on a public share. I can run it on my local machine and it works correctly. When I try to deploy, PDQ says the deployment was successful and yet nothing happens on the target machine. Please help and note that I am a noobie.

Thank you,




Date Votes
  • The reason for this is that the share mapping is user context based. What thaht mean is, that on one computer any user can have different network share mappings. If you map the drive as admin, it will be available only for the admin. If you have a Windows Server and Active Directory, you should utilize the group policy to map drives. (or the logon script).

    BTW, the question has already been asked.

    You can use this command in the batch:

    reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\" /v NetDriveMap /t REG_SZ /d "net use X: \\ServerName\ShareName /persistent:yes"

    What it does, it creates a new entry at the RUN key, which is the net use command including parameters and maps the network drive az X:\ when user loggs in.



  • Thank you SelfMan. I have successfully deployed my drive mapping via group policy using a login.bat file.

    I appreciate the assistance.

  • You are welcome.

  • I realize this post is marked answered, but it might be worth mentioning that it can be done the way OP wants. But it requires that the user needing the mapped drive is logged on. Then you set the package/step to run as logged on user. The user needs to have access to the share to make it work. Either reffer to a bat / cmd file in a install step, or just create a cmd step and add the command there. 

    net use X: \\Server\Share /persistent:yes


Please sign in to leave a comment.

Didn't find what you were looking for?

New post