diff --git a/SamplesV2/SQLServerIntegrationServices/customScript/SetupCustomDns/main.cmd b/SamplesV2/SQLServerIntegrationServices/customScript/SetupCustomDns/main.cmd new file mode 100644 index 00000000..a1b3af80 --- /dev/null +++ b/SamplesV2/SQLServerIntegrationServices/customScript/SetupCustomDns/main.cmd @@ -0,0 +1 @@ +powershell ./setupdnsserver.ps1 "'168.63.129.16'" \ No newline at end of file diff --git a/SamplesV2/SQLServerIntegrationServices/customScript/SetupCustomDns/setupdnsserver.ps1 b/SamplesV2/SQLServerIntegrationServices/customScript/SetupCustomDns/setupdnsserver.ps1 new file mode 100644 index 00000000..10dff0e5 --- /dev/null +++ b/SamplesV2/SQLServerIntegrationServices/customScript/SetupCustomDns/setupdnsserver.ps1 @@ -0,0 +1,11 @@ +$CustomDNSServers = $args[0] + +$ips = Get-NetIPAddress -AddressFamily IPv4 +for ($i = 0; $i -lt $ips.Count; $i++) +{ + $ip = $ips[$i] + if ($ip.IPAddress -ne "127.0.0.1" -and (-not $ip.IPAddress.StartsWith("169.254"))) + { + Set-DnsClientServerAddress -InterfaceIndex $ip.InterfaceIndex -ServerAddresses $CustomDNSServers.Split(" ") + } +} \ No newline at end of file