Quick fix: Windows 11’s Focus (formerly Quiet Hours / Focus Assist) doesn’t directly integrate VPN. Use VPN client’s schedule feature or AutoHotkey scripting. Example: NordVPN → Settings → Auto-connect at specific times. For DIY: schedule rasdial commands via Task Scheduler. For automatic VPN on certain Wi-Fi: Settings → Network & internet → VPN → Add VPN connection → Auto-connect.
“Quiet Hours” in Windows blocks notifications. Combining with VPN auto-connect requires the VPN client’s own schedule, AutoHotkey, or Task Scheduler. Microsoft doesn’t integrate VPN with Focus.
Affects: Windows 11.
Fix time: ~15 minutes.
What causes this need
Common use cases:
- Auto-connect VPN when working from home / cafe.
- Auto-disconnect VPN when on trusted home Wi-Fi.
- Schedule VPN to avoid daytime productivity slowdown.
- Different VPN profiles for work vs personal.
Focus / Quiet Hours doesn’t bind to VPN. Workarounds via VPN client’s schedule or Task Scheduler.
Method 1: Use VPN client’s built-in schedule
The standard route.
- Most modern VPN clients have schedule features:
- NordVPN: Settings → Auto-connect → pick networks / schedule.
- ExpressVPN: Preferences → General → auto-connect at startup.
- Surfshark: Settings → VPN settings → auto-connect.
- OpenVPN: GUI doesn’t schedule; use Task Scheduler.
- Configure within VPN: pick when to auto-connect (always, specific networks, scheduled times).
- For specific Wi-Fi: VPN connects when on untrusted networks, disconnects on home.
- For scheduled: VPN connects at 8 AM, disconnects at 6 PM.
- For per-app traffic routing: VPN with split tunneling (NordVPN, ExpressVPN, Mullvad).
This is the standard schedule.
Method 2: Schedule via Task Scheduler + rasdial
For Windows-native VPN.
- Windows native VPN (built-in PPTP, L2TP, IKEv2, SSTP) uses
rasdial. - Connect:
rasdial "VPN_Name" username password. - Disconnect:
rasdial "VPN_Name" /disconnect. - Schedule via Task Scheduler:
- Open Task Scheduler.
- Create task. Trigger: at logon, or scheduled time, or specific event.
- Action: Start a program. Program:
rasdial. Arguments:"VPN_Name" username password.
- Create second task for disconnect at end time.
- For network-event trigger: Task Scheduler → Triggers → On an event → pick Network event.
- Example: connect VPN when Wi-Fi disconnects (not home), disconnect when Wi-Fi reconnects.
- For specific Wi-Fi names: PowerShell script checks SSID, conditionally connects.
- Caveat: storing VPN credentials in plain text in tasks is insecure. Use Windows Credential Manager.
This is the Windows-native automation.
Method 3: PowerShell script with Focus / Wi-Fi triggers
For custom integration.
- For checking Focus mode state in PowerShell:
# Not directly accessible via PowerShell; use registry check Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings" -Name "NOC_GLOBAL_SETTING_TOASTS_ENABLED" -ErrorAction SilentlyContinue - For Wi-Fi SSID check:
$ssid = (netsh wlan show interfaces | Select-String '^\s+SSID' | ForEach-Object { ($_ -split ':')[1].Trim() })[0] Write-Host "Current SSID: $ssid" if ($ssid -ne "HomeWiFi") { rasdial "MyVPN" $username $password } else { rasdial "MyVPN" /disconnect } - Schedule this script every 5 minutes via Task Scheduler.
- For combining with Focus / Do Not Disturb: same script can check Focus state and conditionally connect.
- For credentials: use Windows Credential Manager:
Get-StoredCredentialfrom CredentialManager module. - For complex: write Python script with auth, store credentials in Windows Credential Manager.
- For monitoring tools: NetSetMan, EvoVPN have profile switching based on Wi-Fi.
This is the DIY route.
How to verify the fix worked
- VPN connects/disconnects on schedule or per Wi-Fi.
- VPN client shows scheduled connections.
- Task Scheduler shows the tasks active.
- For Focus integration: Focus state changes paired with VPN.
If none of these work
If schedule doesn’t trigger: VPN client doesn’t have schedule feature: try AutoHotkey for keyboard automation. For corporate VPN: IT may have its own VPN client with policy. Contact IT. For rasdial errors: ensure VPN profile name matches exactly. For credential issues: Microsoft removed plaintext credentials in newer rasdial. Use saved credentials in connection. For chronic disconnects: VPN client’s own reconnect feature. For Focus integration goal: Focus only blocks notifications, not network. Use VPN client’s scheduler for actual VPN control. For specific Wi-Fi behavior: NetSetMan, NetSetMan Pro for advanced profile switching.
Bottom line: Focus / Quiet Hours doesn’t integrate VPN directly. Use VPN client’s built-in scheduler (NordVPN, ExpressVPN). Or Task Scheduler + rasdial for Windows-native VPN. Custom PowerShell for SSID-based VPN switching.