Hi All,
What am I doing wrong with the code below?
$data=@()
write-host $data
$data = Import-CSV "C:\scripts\Data.csv" -header ZoneName,Name,DescriptiveText
ForEach-Object {
Add-DnsServerResourceRecord -ZoneName $data.ZoneName -Txt -Name $data.Name -DescriptiveText $data.DescriptiveText
}
CSV Example:
domain1.co.uk,cloudflare-verify,000-000 domain2.co.uk,cloudflare-verify,000-001
I get the following error:
Add-DnsServerResourceRecord : Cannot process argument transformation on parameter 'ZoneName'. Cannot convert value to type System.String.
Tried playing around with [string] arguments but I’m doing something wrong.
I’m not great with PS so any help is welcome!
Thank you