🌐 🇵🇱 Polski · 🇬🇧 EN
If you use Windows and frequently access data stored on other computers in your network or other network-shared resources, the standard practice is to map them as network drives so they are available every time you start your computer. By right-clicking in "This PC" (or "My Computer"), you have the option to add a network location. While this is straightforward, it sometimes happens that upon system startup, Windows attempts to connect these drives before the network stack is fully initialized. This can occur for various reasons, such as domain login delays or extended authentication times, resulting in the resources failing to connect and requiring a manual reconnect. A potential solution is to adjust the service startup order (which is not always straightforward in Windows) or simply introduce a delay, for example, of one minute. I decided to delay the mounting process, which works perfectly when the mounting attempt happens faster than the network initialization.
Step 1 - Launching the cmd console
Press the Win+r keys and type "cmd" (in some cases, you may need to run the cmd console with administrator privileges).
Step 2 - Creating the file for mounting remote resources in the appropriate location.
This will open Notepad (in the correct directory) where we will create a file named netlogon.bat.
Step 3 - Entering the code
timeout /t 60
net use Z: \\some_resource\some_directory
The code above ensures that the network resource is mounted as drive "Z". (Remember that there should be a space after the drive letter and colon).
We can also configure automatic login to the resource if credentials are required.
@echo off
timeout /t 60
net use Z: "\\some_resource\some_directory" /user:domain\username some_password
timeout /t 60
net use Z: "\\some_resource\some_directory" /user:domain\username some_password
You can mount multiple resources at once:
@echo off
timeout /t 60
net use Z: \\host123\directory_1 /user:mydomain\user1 password
net use X: \\192.156.45.111\disk$
To test if everything is working correctly, you can run the "net use..." commands directly in the cmd console or execute the netlogon.bat file. In this example, the delay is set to 60 seconds.

Comments