Skip to content

Instantly share code, notes, and snippets.

@sasqwatch
Forked from 1ijack/disable_multicast.cmd
Created October 19, 2023 19:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sasqwatch/162984252e2275c51d716fbcecc347cf to your computer and use it in GitHub Desktop.
Save sasqwatch/162984252e2275c51d716fbcecc347cf to your computer and use it in GitHub Desktop.
change DNSClient/LLMNR behavior [enable/disable/restoreDefault] using windows registry. Restart maybe required for the settings to take effect.
:: by JaCk (script struture/functions only) | Release 09/04/2018 | url https://gist.github.com/1ijack/bd5ed0da9bcaebb2a14e3698cefe7a49 | disable_multicast.cmd -- change DNSClient/LLMNR behavior [enable/disable/restoreDefault] using windows registry. Restart maybe required for the settings to take effect.
:: Original source -- https://computerstepbystep.com/turn-off-multicast-name-resolution.html#CMD
@goto:argParser
rem - JaCkd Note: this seems backwards, but per site instructions: Enable = 0; Disable = 1
rem ~ Posted on [unknown] at url [https://computerstepbystep.com/turn-off-multicast-name-resolution.html#PowerShellScript]
rem *Description*: Local Link Multicast Name Resolution (LLMNR) is a secondary name resolution protocol. Queries are sent over the Local Link, a single subnet, from a client machine using Multicast to which another client on the same link, which also has LLMNR enabled, can respond. LLMNR provides name resolution in scenarios in which conventional DNS name resolution is not possible.
rem If you enable this policy setting, Multicast name resolution or LLMNR, will be turned off for the machine across all available but un-configured network adapters.
rem If you disable this policy setting, Multicast name resolution or LLMNR, will be turned on for the machine across all available but un-configured network adapters.
rem If you do not configure this policy setting, Multicast name resolution or LLMNR, will be turned on for the machine across all available but un-configured network adapters by default.
rem Supported on: At least Windows Vista.
:enableCmd
REG add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\DNSClient" /v EnableMulticast /t REG_DWORD /d 0 /f
@goto:eof
:disableCmd
REG add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\DNSClient" /v EnableMulticast /t REG_DWORD /d 1 /f
@goto:eof
:notConfiguredCmd
REG DELETE "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\DNSClient" /v EnableMulticast /f
@goto:eof
:argParser
@set "#pA=%~1"
@if not defined #pA @call :disableCmd
@for %%A in ( enable; yes; true ) do @if /i "%#pA%" equ "%%A" call :enableCmd
@for %%A in ( disable; no; false ) do @if /i "%#pA%" equ "%%A" call :disableCmd
@for %%A in ( unset; notconfigured; default; restore) do @if /i "%#pA%" equ "%%A" call :notConfiguredCmd
@shift /1 &@set "#pA=%~1"
@if not defined #pA @goto:eof
@goto:argParser
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment