Creating and Using Login Scripts If you are a network administrator then a login script can be a very useful tool. You will have provided your users with various network drives, printers and other resources and a script can ensure that they connect to them in a controlled manner.
This page is a good starting point for creating logon scripts for those that want to build a logon script in the Script Editor instead of using point and click in the Home Screen. Learn how to connect UNC and IP printers and shares based on Active Directory groups, physical locations or prompting for printers through a graphical printer selection menu.
The question asks how to run a script when a USB drive is mounted. This answer says how to do run a script that does mounts a USB drive when it is inserted. The difference matters to me because I have such a script (for a digital camera); without the script, the drive may or may be mounted on insertion (depending on user settings) and it's only when the drive is mounted that I want to do.
For a user in Active Directory, you would simply open the properties for the user and click on the Profile tab. In the Logon Script box, type the name of the script that was saved on the server to.
Login Scripts. Login scripts can be used for many purposes:. If users are allowed to map their own drives, you may want to consider disconnecting drives before mapping them: Batch: reconnect drives. on a server where all Authenticated Users have Write permissions. The directory per date can be created by a scheduled task on the server.
The mapped drive script is a script that will map a drive based on the computer’s IP address. The scenario is that you work for a company that has different departments on different floors of the building. Each floor has an assigned subnet. You will need to discover the IP address of the computer and map a drive to the departments shared folder.
While this would work is requires more section labels and increases administration of the script. Using the method in most of the examples on this page means that each printer, drive mapping etc is contained under a single section label. It makes the script look neater, easier to follow and to manage. Cutting and pasting is very straight forward.
There are two ways to get around this issue: one is to try a registry hack to allow mapped drive access via an administrative command prompt; another way is to use the 'net use' command to re-map the drive. I'll explain both methods below. How to Fix: Can't Access Mapped Network Drive via Administrative Command Prompt.