I have the following script, but am getting an error -
Script -
$CNAMES = Get-Content "C:\Temp\alias.txt"
$Query = "Select * from MicrosoftDNS_CNAMEType"
$Record = Get-WmiObject -Namespace "root\microsoftdns" -Query $Query -ComputerName 10.10.10.1 | Where-Object{$_.Ownername -match $CNAME}
Foreach($CNAME in $CNAMES)
{
$Record.RecordData = "some.server.net"
$Record.put()
}
Error -
Property 'RecordData' cannot be found on this object; make sure it exists and is settable. At C:\temp\DNSUpdateCNAMETarget_02.ps1:7 char:9 + $Record. <<<< RecordData = "some.server.net" + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : PropertyAssignmentException
Method invocation failed because [System.Object[]] doesn't contain a method named 'put'. At C:\temp\DNSUpdateCNAMETarget_02.ps1:8 char:12 + $Record.put <<<< () + CategoryInfo : InvalidOperation: (put:String) [], RuntimeExcept ion + FullyQualifiedErrorId : MethodNotFound
TIA