I recently completed a job were the company insisted in powering down the work station every night. This caused a problem because there were shared drives on the server which did not reconnect a boot time. The drives would appear to be disconnected with red X’s however when the user clicked on them they would connect. So although they were working the fact that they did not auto connect was annoying.
I decided to ask some of my Windows Server expert friends and they informed me this was normally done with log on scripts. Since I am more of a Linux guy , I did not know this. So while this article may seem simple to some, to some one who has used Linux all their lives it was not so simple.
In order to make this work you need a few pieces of information:
- The server name
- The names of the shared drives
- The letters of the shared drives
- The letters of 2 drives which are not in use on the server or any work stations
Lets log on our server and add the scripts:
Once we get logged on to our server we need to create a batch file. I named mine share.bat but you can of course call it whatever you want. Inside the file you can copy and paste my script and then edit it to suit your preferences.
- net use i: \\wbserver\netlogon
- net use i: /d /y
- net use n: /d
- net use p: \\wbserver\public /y
- net use q: \\wbserver\quickbooks /y
- In my example the server name is wbserver so add the name of your server to the 3 places I have wbserver.
- The drives i and n need to be two drives that are not in use on you server. The server will use these to create some temporary stuff for the script to work.
- c:\ of course needs to be the drive of the server
- p and q are the two drives I want to map. These should already be mapped on the client machine and working
- public and quickbooks are the two shares I wanted mounted when the user logs on
So just to recap. I have a server called wbserver which resides on drive C:\. I have two shared folders called public and quickbooks which are mapped to each of my client worksations. I am using P:\ for public and Q:\ for quickbooks. Drives I:\ and N:\ are not in use by any server so they are free for temp drives.
Once we have the share.bat file created we need to place it in the domain controller’s \\server_name\NETLOGON dir:
So in my case in goes in \\wbserver\NETLOGON\share.bat
Once we do that we need to open up the start menu and go to manage our server:
I did not feel comfortable making screen captures of my clients server so I found a few pictures on the net to illustrate my point. So if the names don’t match that’s why.
Right click on the user that you want to have the shares mounted at boot time:
Select properties and a box will open with all the options for this particular user. The tab we are interested in is “Profile”.
As you can see there is a box where we can enter a name of a logon script:
Add the name of your script in the box and save. You will need to do this for each user on the Domain controller who you wish to have auto access to the drives. Once you are finished adding the script to each users, log of all of your clients and log them back on and the drives should auto mount. This will work for any machine in the domain that the user logs on to, so the drives will always be available to them.
Hope this can save some one else some time because it really did for me. Special thanks to my friend Slops for the script.