public sealed class WindowsDnsClient Windows DNS server administration through its MicrosoftDNS provider.
Remarks
The server must have the DNS role/provider installed. Uses the caller's identity unless credentials are supplied. A remote server is reached over WMI/DCOM with Kerberos to its host/ principal, so name it by its DNS or NetBIOS name; an IP address fails with ArgumentException when an operation connects.
Constructors
WindowsDnsClient
public WindowsDnsClient(string server, NetworkCredential? credential = null, TimeSpan? queryTimeout = null) Creates an explicit server client. Timeout bounds WMI query waits; it is not a hard cancellation deadline for server mutations.
Methods
CreateAsync
public Task CreateAsync(DnsRecordSpecification specification, CancellationToken cancellationToken = default) Creates one record. Existing identical data is a conflict; other records in the set are preserved.
DeleteAsync
public Task<bool> DeleteAsync(DnsRecordKey key, CancellationToken cancellationToken = default) Deletes exactly one matching record. Returns false when absent; never removes a complete record set implicitly.
Remarks
The deletion is read back; a record that the server still holds afterwards is reported as a failure.
EnumerateRecordsAsync
public Task<ImmutableArray<DnsRecordSnapshot>> EnumerateRecordsAsync(string zone, string? ownerName = null, CancellationToken cancellationToken = default) Enumerates records, including unsupported native types as preserved textual records.
EnumerateZonesAsync
public Task<ImmutableArray<DnsZoneSnapshot>> EnumerateZonesAsync(CancellationToken cancellationToken = default) Enumerates zones and their AD integration status.
FindAsync
public Task<DnsRecordSnapshot?> FindAsync(DnsRecordKey key, CancellationToken cancellationToken = default) Finds a unique record by full record data, without assuming an owner name identifies a whole record set.
FindZoneAsync
public Task<DnsZoneSnapshot?> FindZoneAsync(string name, CancellationToken cancellationToken = default) Finds a zone; null means the named zone is absent on this server.
UpdateAsync
public Task UpdateAsync(DnsRecordKey key, DnsRecordUpdate update, CancellationToken cancellationToken = default) Modifies a single record in place. Record type and owner remain unchanged.
Remarks
Only the values that change are sent to the DNS server, and the result is read back. A modification that the server applies differently is reported as a failure.