Windows OS Hub
  • Windows
    • Windows 11
    • Windows Server 2022
    • Windows 10
    • Windows Server 2019
    • Windows Server 2016
  • Microsoft
    • Active Directory (AD DS)
    • Group Policies (GPOs)
    • Exchange Server
    • Azure and Microsoft 365
    • Microsoft Office
  • Virtualization
    • VMware
    • Hyper-V
  • PowerShell
  • Linux
  • Home
  • About

Windows OS Hub

  • Windows
    • Windows 11
    • Windows Server 2022
    • Windows 10
    • Windows Server 2019
    • Windows Server 2016
  • Microsoft
    • Active Directory (AD DS)
    • Group Policies (GPOs)
    • Exchange Server
    • Azure and Microsoft 365
    • Microsoft Office
  • Virtualization
    • VMware
    • Hyper-V
  • PowerShell
  • Linux

 Windows OS Hub / Windows 10 / How to Connect VPN Before Windows Logon

November 14, 2023 PowerShellWindows 10Windows 11

How to Connect VPN Before Windows Logon

By default, the built-in Windows VPN client does not allow you to connect to the VPN server until the user logs in. This is inconvenient for Active Directory-joined computers connected to the domain network via VPN. Of course, users can sign in to their computer using cached domain credentials and then establish a VPN connection. However, access to shared folders and other domain resources will be a constant problem for these users (especially after changing or resetting the domain password).

Windows allows you to connect to the VPN server before the user logs in. In this case, once a VPN connection has been established, the user will perform a full authentication on the AD domain controller.

In previous versions of Windows, this could be achieved using the ‘Allow other people to use this connection‘ in the VPN connection settings. However, this option is missing from current versions of Windows 10 and 11.

VPN before login Windows with the option 'Allow other people to use this connection'

In new versions of Windows, you can create a shared VPN connection from the PowerShell console. For example, to create an L2TP VPN connection with a shared key, use the command:

Add-VpnConnection -Name WorkVPN_L2TP -ServerAddress "vpn.woshub.com" -TunnelType L2TP -L2tpPsk "My1pre-SharedKey2" -Force -EncryptionLevel "Required" -AuthenticationMethod MSChapv2 -RememberCredential -AllUserConnection $true –PassThru

How to fix L2TP/IPsec VPN connection error on Windows.

In this case, the -AllUserConnection $true option allows you to create a shared VPN connection that is available to all Windows users, including on the Windows login screen.

See the examples of using the Add-VpnConnection cmdlet to create other types of VPN connections (PPTP, SSTP, IKEv2) in the post “Manage Windows VPN Connections with PowerShell“.

You can later change the shared VPN connection settings from the Control Panel graphical interface (ncpa.cpl).

If you already have a VPN connection in your profile, you can make it public by copying rasphone.pbk file from the %userprofile%\AppData\Roaming\Microsoft\Network\Connections\PBK to C:\ProgramData\Microsoft\Network\Connections\PBK.

copy rasphone.pbk file with VPN connection settings to public user profile

You can now connect to the VPN from the Windows login screen. Click on the network connection icon in the bottom right-hand corner.

Enable login screen VPN connection on Windows

Type in the user name and password for the VPN connection.

vpn connection credentials

Your computer should establish a VPN connection to your company network, and you can sign in to Windows using your domain user account.

Connect VPN before user signing in Windows

If the VPN is disconnected for any reason, the user can reconnect using the VPN icon in the system tray or in Settings (or you can configure an automatic reconnection to the VPN).
1 comment
4
Facebook Twitter Google + Pinterest
previous post
Removing Azure Arc Setup Feature on Windows Server 2022
next post
Create a No-Reply Email Address in Exchange Server/Microsoft 365

Related Reading

How to Cancel Windows Update Pending Restart Loop

May 6, 2025

View Windows Update History with PowerShell (CMD)

April 30, 2025

Change BIOS from Legacy to UEFI without Reinstalling...

April 21, 2025

Remove ‘Your License isn’t Genuine’ Banner in MS...

April 21, 2025

Uninstalling Windows Updates via CMD/PowerShell

April 18, 2025

1 comment

E November 16, 2023 - 4:16 am

Very helpful thanks

Reply

Leave a Comment Cancel Reply

join us telegram channel https://t.me/woshub
Join WindowsHub Telegram channel to get the latest updates!

Categories

  • Active Directory
  • Group Policies
  • Exchange Server
  • Microsoft 365
  • Azure
  • Windows 11
  • Windows 10
  • Windows Server 2022
  • Windows Server 2019
  • Windows Server 2016
  • PowerShell
  • VMware
  • Hyper-V
  • Linux
  • MS Office

Recent Posts

  • Cannot Install Network Adapter Drivers on Windows Server

    April 29, 2025
  • Change BIOS from Legacy to UEFI without Reinstalling Windows

    April 21, 2025
  • How to Prefer IPv4 over IPv6 in Windows Networks

    April 9, 2025
  • Load Drivers from WinPE or Recovery CMD

    March 26, 2025
  • How to Block Common (Weak) Passwords in Active Directory

    March 25, 2025
  • Fix: The referenced assembly could not be found error (0x80073701) on Windows

    March 17, 2025
  • Exclude a Specific User or Computer from Group Policy

    March 12, 2025
  • AD Domain Join: Computer Account Re-use Blocked

    March 11, 2025
  • How to Write Logs to the Windows Event Viewer from PowerShell/CMD

    March 3, 2025
  • How to Hide (Block) a Specific Windows Update

    February 25, 2025

Follow us

  • Facebook
  • Twitter
  • Telegram
Popular Posts
  • Install and Manage Windows Updates with PowerShell (PSWindowsUpdate)
  • How to Delete Old User Profiles in Windows
  • Fix: Remote Desktop Licensing Mode is not Configured
  • Configuring Port Forwarding in Windows
  • How to Install Remote Server Administration Tools (RSAT) on Windows
  • Start Menu or Taskbar Search Not Working in Windows 10/11
  • Adding Drivers into VMWare ESXi Installation Image
Footer Logo

@2014 - 2024 - Windows OS Hub. All about operating systems for sysadmins


Back To Top