Beispiel #1
0
        internal static MsDnsNsRecord Parse(ManagementObject record, MsDnsZone zone)
        {
            MsDnsNsRecord dnsRecord = new MsDnsNsRecord(
                (string)record.Properties["OwnerName"].Value,
                (string)record.Properties["RecordData"].Value,
                zone,
                (int)(UInt32)record.Properties["TTL"].Value);

            return(dnsRecord);
        }
        public List <MsDnsNsRecord> GetNsRecords(MsDnsZone zone)
        {
            ObjectQuery query = new ObjectQuery(
                "SELECT * FROM MicrosoftDNS_NSType WHERE ContainerName = '" + zone.Name + "'");

            ManagementObjectSearcher   searcher         = new ManagementObjectSearcher(WmiScope, query);
            ManagementObjectCollection recordCollection = searcher.Get();

            List <MsDnsNsRecord> recordList = new List <MsDnsNsRecord>();

            foreach (ManagementObject record in recordCollection)
            {
                recordList.Add(MsDnsNsRecord.Parse(record, zone));
            }
            return(recordList);
        }