Net Use Batch File Deployment

0

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,

CG

Cancel
login to comment
0

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

Cancel
login to comment

0

You are welcome.

Cancel
login to comment

0

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

I appreciate the assistance.

Cancel
login to comment

0

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).

http://blog.zwiegnet.com/windows-server/map-network-shared-drive-in-group-policy/

BTW, the question has already been asked.

http://support.adminarsenal.com/entries/238692-Remote-net-use

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.

 

 

Cancel
login to comment

Reply