Difference between revisions of "Set DNS with powershell"
From DevOps Notebook
(Created page with "===Set primary windows dns with powershell script=== <pre> $dnsserver = (,"1.1.1.1") Get-WmiObject -Class Win32_NetworkAdapterConfiguration -Filter IPEnabled=TRUE | Invoke-Wmi...") |
|||
Line 1: | Line 1: | ||
===Set primary windows dns with powershell script=== | ===Set primary windows dns with powershell script=== | ||
− | < | + | <syntaxhighlight lang="PowerShell"> |
$dnsserver = (,"1.1.1.1") | $dnsserver = (,"1.1.1.1") | ||
Get-WmiObject -Class Win32_NetworkAdapterConfiguration -Filter IPEnabled=TRUE | Invoke-WmiMethod -Name SetDNSServerSearchOrder -ArgumentList (,$dnsserver) | Get-WmiObject -Class Win32_NetworkAdapterConfiguration -Filter IPEnabled=TRUE | Invoke-WmiMethod -Name SetDNSServerSearchOrder -ArgumentList (,$dnsserver) | ||
− | </ | + | </syntaxhighlight> |
Latest revision as of 10:37, 31 January 2023
Set primary windows dns with powershell script
$dnsserver = (,"1.1.1.1")
Get-WmiObject -Class Win32_NetworkAdapterConfiguration -Filter IPEnabled=TRUE | Invoke-WmiMethod -Name SetDNSServerSearchOrder -ArgumentList (,$dnsserver)