Source of demand: an organization's Active Directory domain, where a subset of the domain controller's SRV records will be discarded for no reason, dcdiag check DNS, found a lot of error, see the error basically do not want to get, too much ...
PowerShell enables quick creation of a and DNS records.
Let's see what the standard SRV records look like.
Ps c:\>get-wmiobject -namespace root\microsoftdns -class microsoftdns_srvtype | ? {$_. dnsservername -eq "Dc.contoso.com"}__genus : 2__class : microsoftdns_srvtype__superclass : microsoftdns_ resourcerecord__dynasty : cim_ Managedsystemelement__relpath : microsoftdns_ Srvtype.containername= "_msdcs.contoso.com", dnsservername= "DC.contoso.com", Domainname= "_tcp". Default-first-site-name._sites.dc._msdcs.contoso.com ", ownername=" _kerberos. _tcp. Default-first-site-name._sites.dc._msdcs.contoso.com ", RecorDclass=1,recorddata= "0 100 88 dc2.contoso.com." __property_count : 18__derivation : { microsoftdns_resourcerecord, cim_logicalelement, cim_managedsystemelement}__server : DC__NAMESPACE : root\MicrosoftDNS__PATH : \\dc\root\microsoftdns:microsoftdns_srvtype.containername= "_msdcs.contoso.com", DnsServerName= " DC.contoso.com ", Domainname=" _tcp. default-first-site-name._sites.dc._msdcs.contoso.com ", Ownername=" _kerberos._tcp. Default-first-site-name._sites.dc._msdcs.contoso.com ", Recordclass=1,recorddata=" 0 100 88 Dc2.contoso.com. " caption &Nbsp; : containername : _ msdcs.contoso.comdescription : dnsservername : dc.contoso.comdomainname : _tcp. default-first-site-name._sites.dc._msdcs.contoso.cominstalldate : name : ownername : _kerberos._tcp. default-first-site-name._sites.dc._msdcs.contoso.comport : 88Priority : 0RecordClass : 1RecordData : 0 100 88 dc2.contoso.com.srvdomainname : dc2.contoso.com.status : textrepresentation : _kerberos._tcp. default-first-site-name._sites.dc._msdcs.contoso.com in srv 0 100 88 dc2.contoso.com.timestamp : 3633513ttl : 600weight : 100PSComputerName : dc
We note that the useful places are the following lines
ContainerName: _msdcs.contoso.comdnsservername:dc.contoso.comownername: _kerberos._tcp. default-first-site-name._sites.dc._msdcs.contoso.comrecorddata:0 dc2.contoso.com.TextRepresentation: _ke Rberos._tcp. Default-first-site-name._sites.dc._msdcs.contoso.com in SRV 0 dc2.contoso.com.
The first thing to explain is the container name, here is the main note, Msdcs this container. Another dnsservername is the name of the domain controller that currently needs to be manipulated.
In Textrepresentation: _kerberos._tcp. Default-first-site-name._sites.dc._msdcs.contoso.com in SRV 0 dc2.contoso.com. In this sentence, it contains all the information we want to enter manually.
We construct a sentence, the last sentence to achieve the goal function
$dnsServerName = "dc.contoso.com" $containerName = "_msdcs.contoso.com" $mydns = [WMIClass] "Root\microsoftdns: Microsoftdns_resourcerecord "$mydns. Createinstancefromtextrepresentation ($dnsServerName, $containerName, _kerberos._tcp. Default-first-site-name._sites in SRV 0 dc3332.contoso.com.)
This article is from the "Nine uncle-Microsoft Private Cloud" blog, please make sure to keep this source http://jiushu.blog.51cto.com/972756/1672103
PowerShell operations DNS creates SRV records