Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Scavenging on MS DNS Server & Zones using WMI

$
0
0

Hi All,

I am current entered in WMI tool to query dns server and change configuration in server & zones. Currently I need to do below changes in DNS Server & Zone level.

1. Enable Scavenging feature in server using C# with WMI code. Need to update Refresh,Non-Refresh Interval and Scavenging Interval through C# code using WMI.

2. Enable Scavenging feature in zones using C# with WMI code. Need to update Refresh,Non-Refresh Interval and enable scavenging in zones through C# code using WMI.

Difficulties:

I am facing problem when I enable scavenge feature in zones. I can connect with dns server using scope & ManagementBaseObject. I wrote below code to enable scavenging in zones,

                string strzone = "firstzone";
                ManagementScope scope = ConnectMachine("root\\MicrosoftDNS");
                string Query = "SELECT * FROM MicrosoftDNS_Zone where Name = '" + strzone + "' ;
                ManagementObject classInstance = SearchObject(Query);

                classInstance["DnsServerName"] = objScavengeInput.serverName;
                classInstance["ContainerName"] = strzone;
                classInstance["Name"] = strzone;
                classInstance["Aging"] = objScavengeInput.EnbaleScavenge ? 1 : 0;
                classInstance["NoRefreshInterval"] = objScavengeInput.NonRefreshInterval;
                classInstance["RefreshInterval"] = objScavengeInput.RefreshInterval;
                //classInstance["AvailForScavengeTime"] = objScavengeInput.AvailTime;
                classInstance.Put();

I am not getting any runtime issues(fatal error) but I can't check "Scavenge stale records" checkbox in zones properties. But, I can update refresh & non-refresh interval from above code. Only problem is can't check that checkbox.

I hope you understand what problem i problem facing and I need to enable this scavenging in zones feature using c# with WMI code.

Please help us to correct this error.

Thanks,

Sharavanna



Viewing all articles
Browse latest Browse all 15028

Trending Articles



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