The most frequent use for login scripts is to connect all users to a certain network share, using the same drive letter. This ensures consistency across the network and can make support and documenting procedures much easier.
For example, if you wanted to connect all users to a share on "Server1" called "Source" using the letter "S", then you would enter the following:
net use s: \\server1\source
You can have as many of these as you like as long as the drive letter is available. For this reason it is usual to use letters high up in the alphabet to avoid any machines with multiple drives, plus CD-ROM drives and other devices that assign a letter.
Using Persistent Drive Mapping Settings
When you use the "net use" command, you have the option of making it persistent - i.e. reconnects after a reboot or logout. This is the same as the "Reconnect at Logon" box that you get when use "Map Network Drive" in Windows Explorer.
Typically with a login script you will make drive letters so that they are NOT persistent. This avoids lots of error messages during the login process about the resource already being in use and if you have changed the drive letter or path in the script, your new settings will be seen.
There are two ways of adjusting these settings.
If you want the setting to apply to all drives mapped in the login script, then place the following command before any others (note the lack of space between the "persistent", the ":" and the "yes/no")
Survive reboot: net use /persistent:yes This session only: net use /persistent:no
If you want to set it on a drive by drive case, then use the following commands:
Survive reboot: net use s: \\server1\source /persistent:yes This session only: net use s: \\server1\source /persistent:no
By changing the location of first variation of the command, some drives could be persistent and others not, without having to set it for each drive.
As an alternative, you could also disconnect each drive first, then run the connect commands.
However if you are introducing a login script, you should disconnect any existing network drive mappings first, so that your script can work. This is easily achieved, just put the following command BEFORE the connecting one indicated above:
net use s: /delete
This disconnects any drive mapping created on the letter "S". It is a good idea to leave these lines in even after introduction. Then if any users disconnect a network drive and create their own (persistent) one, it will overwritten by the login script settings. They will soon get tired of having to reconnect at each login.
Copyright Sembee Ltd. 1998 - 2015.
Reproduction of any content on this web site is prohibited without express written consent. Use of this web site is subject to our terms and conditions.
All trademarks and registered trademarks are property of their respective owners. This site is not endorsed or recommended by any company or organisation mentioned within and is to provide guidance only and as such we cannot be held responsible for any consequences of following the advice given.
Sembee Ltd. is registered in England and Wales at 1 Carnegie Road, Newbury, Berkshire, RG14 5DJ.
Registered company number: 4704428. VAT Number GB 904 5603 43.