fix MsDns2012 NS record bug

This commit is contained in:
dev_amdtel 2014-09-12 13:40:19 +04:00
parent 9fc94fbcb9
commit 323e6d7ad6
2 changed files with 25 additions and 1 deletions

View file

@ -365,7 +365,25 @@ namespace WebsitePanel.Providers.DNS
cmd.addParam( "Force" );
ps.RunPipeline( cmd );
}
public static void Remove_DnsServerResourceRecords(this PowerShellHelper ps, string zoneName, string type)
{
var cmd = new Command("Get-DnsServerResourceRecord");
cmd.addParam("ZoneName", zoneName);
cmd.addParam("RRType", type);
Collection<PSObject> resourceRecords = ps.RunPipeline(cmd);
foreach (PSObject resourceRecord in resourceRecords)
{
cmd = new Command("Remove-DnsServerResourceRecord");
cmd.addParam("ZoneName", zoneName);
cmd.addParam("InputObject", resourceRecord);
cmd.addParam("Force");
ps.RunPipeline(cmd);
}
}
public static void Update_DnsServerResourceRecordSOA(this PowerShellHelper ps, string zoneName,
TimeSpan ExpireLimit, TimeSpan MinimumTimeToLive, string PrimaryServer,
TimeSpan RefreshInterval, string ResponsiblePerson, TimeSpan RetryDelay,

View file

@ -98,12 +98,18 @@ namespace WebsitePanel.Providers.DNS
public virtual void AddPrimaryZone( string zoneName, string[] secondaryServers )
{
ps.Add_DnsServerPrimaryZone( zoneName, secondaryServers );
// remove ns records
ps.Remove_DnsServerResourceRecords(zoneName, "NS");
}
public virtual void AddSecondaryZone( string zoneName, string[] masterServers )
{
ps.Add_DnsServerSecondaryZone( zoneName, masterServers );
}
// remove ns records
ps.Remove_DnsServerResourceRecords(zoneName, "NS");
}
public virtual void DeleteZone( string zoneName )
{