Skip to content

Instantly share code, notes, and snippets.

@agail
Last active June 30, 2022 09:00
Show Gist options
  • Save agail/0d8a4e51b78b2693b0c7d3b25b4aed03 to your computer and use it in GitHub Desktop.
Save agail/0d8a4e51b78b2693b0c7d3b25b4aed03 to your computer and use it in GitHub Desktop.
Dual interface connections - Windows 10
@echo off
::
:: Prohibit connection to non-domain networks when connected to domain-authenticated network
::
:: GPO Path: Computer Configuration/Administrative Templates/Network/Windows Connection Manager/
:: Reg Path: HKLM\Software\Policies\Microsoft\Windows\WcmSvc\GroupPolicy (0|1)
:: Value Name: fBlockNonDomain
:: Value Type: REG_DWORD
:: Values: 0 = Disabled
:: 1 = Enabled
::
SetLocal EnableDelayedExpansion
set regPath=HKLM\Software\Policies\Microsoft\Windows\WcmSvc\GroupPolicy
for /f "tokens=3" %%a in ('reg query %regPath% ^| findstr "fBlockNonDomain"') do (
if not "%%a"=="0x0" (
net session >nul 2>&1
if not !errorLevel! == 0 (
echo Failure: Administrative permissions required, exiting
exit /b
)
reg add %regPath% /v fBlockNonDomain /t REG_DWORD /d 0 /f
) else (
echo Policy already disabled
)
)
EndLocal

Prohibit connection to non-domain networks when connected to domain-authenticated network

  • GPO Path: Computer Configuration/Administrative Templates/Network/Windows Connection Manager/
  • Reg Path: HKLM\Software\Policies\Microsoft\Windows\WcmSvc\GroupPolicy (0|1)
    • Value Name: fBlockNonDomain
    • Value Type: REG_DWORD
    • Values:
      • 0 = Disabled
      • 1 = Enabled

Minimize the number of simultaneous connections to the Internet or a Windows Domain

  • GPO Path: Computer Configuration/Administrative Templates/Network/Windows Connection Manager/
  • RegKey: HKLM\Software\Policies\Microsoft\Windows\WcmSvc\GroupPolicy
    • Value Name: fMinimizeConnections
    • Value Type: REG_DWORD
    • Values:
      • 0 = Allow simultaneous connections
      • 1 = Minimize simultaneous connections
      • 2 = Stay connected to cellular
      • 3 = Prevent Wi-Fi when on Ethernet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment