unknown
2010-06-08 12:09:45 UTC
I am trying to get a list of server names and their primary and secondary
DNS server settings.
If I try the following command:
get-wmiobject Win32_networkadapterconfiguration -computername "servername |
select name, DNSServerSearchOrder
It would give me the specific servername and its dns addresses.
I know have a list of computernames which I would like to list out and their
DNSserversearchorder settings (DNS settings)
I tried putting the list of computernames in a text file by using
get-qadcomputer | export-csv C:\computername.txt -notype
Then I used the get-content command and the piped into the get-wmiobject
command like below:
$servers = Get-Content c:\computername.txt
ForEach ($server in $servers)
{ get-wmiobject Win32_networkadapterconfiguration -computername $server
| where{$_.IPEnabled -match "True"} | select-object
name,DNSServerSearchOrder
But when I run this command it fails with errors such as an empty pipe
element is not permitted. I dont know if the above script has any synatx
errors or what is the best way to get a list of servers and their dns server
settings.
Can anyone please advise
DNS server settings.
If I try the following command:
get-wmiobject Win32_networkadapterconfiguration -computername "servername |
select name, DNSServerSearchOrder
It would give me the specific servername and its dns addresses.
I know have a list of computernames which I would like to list out and their
DNSserversearchorder settings (DNS settings)
I tried putting the list of computernames in a text file by using
get-qadcomputer | export-csv C:\computername.txt -notype
Then I used the get-content command and the piped into the get-wmiobject
command like below:
$servers = Get-Content c:\computername.txt
ForEach ($server in $servers)
{ get-wmiobject Win32_networkadapterconfiguration -computername $server
| where{$_.IPEnabled -match "True"} | select-object
name,DNSServerSearchOrder
But when I run this command it fails with errors such as an empty pipe
element is not permitted. I dont know if the above script has any synatx
errors or what is the best way to get a list of servers and their dns server
settings.
Can anyone please advise