Windows Server 2008 – Permanent Network Share Mapping

I recently found the need for permanently mounted network shares on a Windows server. Not an obvious thing to do, unfortunately…

What do I mean by permanent? When mapping a share on Windows as a user, when that user logs off… the share will disconnect. For an installed Windows Service that requires access to defined network shares – this is unworkable. We need to create network shares that retain their connection no matter whether or not a particular user is logged on.

Why do I need to do this? For a server-based AIR project ;D

Took a lot of searching – but here is how to do it!


First, we need to get into the Windows Server Group Policy Editor. The simplest way to access this is to type “gpedit” into the start menu search. The Group Policy Editor will now appear.

Using the left navigation menu, drill down through Computer Configuration > Windows Settings > Scripts (Startup/Shutdown). Double-click on Startup to open the Startup Properties dialog.

From the Scripts tab, we will want to click on the Show Files… button to open a File Explorer window.

Right-click in this window to create a new text file called mapping.bat (or whatever you want to call it). This needs to be a .bat file though to execute commands properly.

Edit the file and add the following lines of code:
net use m: \\servername\share

Add one command like this for each share you wish to add.

Now, return to the Startup Properties dialog and click Add… to browse to and select the .bat file we just created. It will appear in the list of startup scripts.

Exit the dialog by clicking OK.

You’ll now need to restart the server for this to take effect. This will allow the startup process to run the required commands to mount these network shares without any user being logged on.

3 thoughts on “Windows Server 2008 – Permanent Network Share Mapping”

  1. This didn’t work for me.

    It looks like the startup script runs before the network service starts, so the drive gets mapped but authentication fails. When the application tries to connect, it needs to re-authenticate (which it can’t) so it fails to establish a connection.

    I guess it would work if the share doesn’t require authentication.

    Let me know if you have any solutions for this. At this point it looks like I’m going to have to resort to creating a Windows Service myself which authenticates against the share after the network service starts… :(

Leave a Comment

Your email address will not be published. Required fields are marked *