How to Permanently Mount a Network Share in Windows Without User Login (Domain/Non-Domain Solutions)


39 views

As a Windows administrator, you've likely encountered scenarios where you need a network drive to remain mounted before any user logs in—similar to Unix's /etc/fstab functionality. This becomes critical for:

  • Service accounts accessing shared resources
  • Domain-joined storage appliances (like BlackArmor NAS)
  • Automated backup systems requiring persistent connections

The common approach using Group Policy startup scripts with net use often results in disconnected drives because:

:: This runs in system context before network stack is fully initialized
net use x: \\server\share /user:domain\user password /persistent:yes

The key limitations are:

  • Timing issues with network service initialization
  • Lack of proper credential handling in machine context
  • Session isolation for mapped drives

Option 1: Group Policy Preferences (Recommended)

1. Open Group Policy Management Editor
2. Navigate to:
   Computer Configuration → Preferences → Windows Settings → Drive Maps
3. Create new mapped drive with:
   - Action: Update
   - Location: \\server\share
   - Reconnect: Enabled
   - Label: DataShare
   - Use: "Alternate credentials" (domain account)
4. Enable item-level targeting if needed

Option 2: Scheduled Task with SYSTEM Account

schtasks /create /tn "Mount Network Drive" /tr "net use x: \\server\share /persistent:yes" /sc onstart /ru "NT AUTHORITY\SYSTEM" /rl HIGHEST

For standalone systems or non-domain joined NAS devices:

PowerShell -Command "
$cred = New-Object System.Management.Automation.PSCredential('username', (ConvertTo-SecureString 'password' -AsPlainText -Force))
New-PSDrive -Name X -PSProvider FileSystem -Root '\\server\share' -Credential $cred -Persist -Scope Global
"
Issue Solution
Drive shows as disconnected Check "Computer Browser" service and SMB1 compatibility
Access denied errors Verify share permissions (not just NTFS) and credential delegation
Random disconnections Disable power saving on NIC and set KeepConn=60000 in registry

For systems requiring absolute persistence:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\DOS Devices]
"X:"="\\??\\UNC\\server\\share"

Warning: This bypasses normal authentication - only use with null session shares or extremely restricted permissions.

  • Always use dedicated service accounts with minimal permissions
  • Consider IPsec or SMB encryption for sensitive data
  • Regularly audit share access through Windows Event ID 5145
  • For NAS devices, enable SMB 3.1.1 and disable SMB1



When managing Windows Server 2008 R2 environments, administrators often need network shares available before any user logs in - similar to Unix's /etc/fstab functionality. Traditional methods like startup scripts often fail, leaving drives in a "disconnected" state.

The net use command in startup scripts runs before network interfaces are fully initialized. The command executes but can't establish the connection, resulting in those frustrating disconnected drives.

Here are three proven methods to achieve persistent mounting:

1. Registry-Based Persistent Drive Mapping

Create a REG file with this content (save as persistent_drive.reg):

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]
"MapNetworkDrive"="cmd.exe /c \"net use x: \\\\server\\share /persistent:yes /user:domain\\username password\""

Note: For security, consider using:

net use x: \\server\share /persistent:yes /user:domain\username *

This will prompt for password during installation instead of storing it plaintext.

2. Scheduled Task Approach /h2>

Create a task that triggers at system startup with 1-minute delay:

schtasks /create /tn "Map Network Drive" /tr "net use x: \\server\share /user:domain\username password" /sc onstart /delay 0001:00 /ru "SYSTEM"

3. Group Policy Preference (Recommended)

For domain environments, this is the most robust solution:

  1. Open Group Policy Management
  2. Navigate to: Computer Configuration > Preferences > Windows Settings > Drive Maps
  3. Create new mapped drive with these key settings:
    • Action: Create
    • Location: \\server\share
    • Reconnect: Checked
    • Label as: Your preferred name
    • Use: Specific credentials (create dedicated service account)
  • Create a dedicated service account with minimal permissions
  • Set password to never expire
  • Use domain isolation to restrict access
  • For NAS devices: Enable SMB signing and encryption
# Test connectivity first:
Test-NetConnection -ComputerName server -Port 445

# Check existing mappings:
Get-SmbMapping

# View credential cache:
cmdkey /list

For Windows Server 2012 R2 and newer, consider PowerShell:

New-SmbGlobalMapping -LocalPath x: -RemotePath \\server\share -Persistent $true -Credential (Get-Credential)