Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Usage of Set-DNSServerSetting

$
0
0

Hello all togehter,

I have severall Windows 2012 DCs with DNS installed. Until now, I use a batch file to configure the DNS for my demands. Since 2012, I can configure DNS with PowerShell and I want to fully migrate the cmd commands to PowerShell. Basically this should work, but I do not fully understand how the Set-DNSServerSetting cmdlet works.

For example, I want to change the setting for "LocalNetPriority" and "RoundRobin".

If I use Get-DNServerSetting -All, PowerShell displays me the current values for these settings (true or false). And as the cmdlet help shows in the example, I can use "Get-DNSServerSetting -All -Computername Server007 | Set-DNSServerSetting" to copy the settings from an existing server.

However, I don't want to copy the settings, but just write the settings as I defined, like "$MySettings | Set-DNSServerSetting", where $MySettings contains the Object with all settings I need. But how can I create such an object in my script, without copying the settings from another DNS server?

To be more clear: I wish the Set-DNSServerSetting cmdlet would work like "Set-DNSServerSetting -RoundRobin $true -LocalNetPriority $true", but it doesn't. Who has a workaround for me?

Thanks,
Michael

PS: I know, dnscmd would also work in my PowerShell script, but I try to use PowerShell cmdlets.


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>