Automate Network Drive Map at Boot not login
Although this is a nice writeup. It does not work. When I originally created this process, I tested several times with success. Somewhere over time, critical updates and service packs broke this process. I will leave this article as is as it may help in some other design.
AutoIT v3 (Freeware) Download: http://www.autoitscript.com/autoit3/downloads.php
Map a drive and pass appropriate credentials without compromising security. Use AutoIT, a script language, to compile into executable. Run the executable through a Scheduled Task.
AutoIT offers some security, and it is better than most. Also note that there is a decompiler that does exist for many versions of AutoIT, however is quite rare and with little visibility. AutoIT also appears to operate in memory rather than writing to temp folder unencrypted like many other script compilers.
After a couple of hours of testing, the conclusion is that whatever account that accesses the Scheduled task, it should have administrator rights, either local or domain. I tested with local administrator account to launch the scheduled task, which will launch the executable with success. The test not only mapped the drive, but to copy a file to that mapped drive. The test included rebooting the workstation and checking the network drive for the copied file. The test was a success, so I removed that one line of code to copy the file.
Note: The solution assumes that AutoIT is installed. Install the latest version of AutoIT v3 by following the setup instructions.
- Launch SciTE4AutoIT3 (Start -> All Programs -> AutoIT v3 -> SciTE Script Editor)
- Type in the following lines in the script editor
; Map X drive to \\myserver2\stuff2 using the user "username" from "domainx" with password "userpassword" DriveMapAdd("h:", "\\nasserver\share", 0, "domain\username", "password")
- Save file
- Create an executable (Tools -> compile) Note: You should now have an EXE.
- Create a Scheduled Task (Control Panel -> Scheduled Tasks)
- Click on Add Scheduled Task and the Scheduled Task Wizard window will appear.
- Click Next -> Browse? (to your EXE)
- Select When my computer starts , Next
- Use an account with either local or domain administrator rights (to execute your executable)
- Select Open advanced properties … , Finish
- Go to Schedule Tab, Select Multiple Schedules
- New, 2. Run at user logon, apply
- Go to Settings Tab, uncheck all, apply