Albert Widjaja
asked on
How to get the DNS of domain joined server from a list or specific OU ?
Hi Folks,
I'm about to decommission one of the old server which is currently serving as DNS server in my Data Center.
Most or lots of the legacy servers in my AD domain got the static DNS pointing to this server. So how can I get the list of the server with its DNS settings in a CSV format ?
Example:
Server name, DNS1, DNS2
Thanks.
I'm about to decommission one of the old server which is currently serving as DNS server in my Data Center.
Most or lots of the legacy servers in my AD domain got the static DNS pointing to this server. So how can I get the list of the server with its DNS settings in a CSV format ?
Example:
Server name, DNS1, DNS2
Thanks.
Although it's possible to get this information, if the plan is to replace this server with a new one, why don't you just stand up the new server with the same IP? Then you don't have to change any config.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Because. New server is already running as new DC & DNS integrated while the old server is still running as the Win 2003 AD DC DNS box
ASKER
Thanks Will, I'll give it a try in the office on Monday.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks Will.
@Footech: May I know what's your script does in Line 1 and Line 8 ? Does it change the statically assigned DNS server into 10.10.0.1 ?
@Footech: May I know what's your script does in Line 1 and Line 8 ? Does it change the statically assigned DNS server into 10.10.0.1 ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
@Will:
Somehow the script failed to get the list of current server from specific OU and its DNS server into the Excel spreadsheet:
Error code below:
and the result of the CSV is shown below:
Somehow the script failed to get the list of current server from specific OU and its DNS server into the Excel spreadsheet:
$Computers = Get-ADComputer -Filter * -SearchBase "OU=Production Servers,OU=Servers,DC=Domain,DC=com"
ForEach ($Computer in $Computers) {
Get-WMIObject -class Win32_NetworkAdapterConfiguration | ? {$_.IPAddress -notlike $Null} | select $Computer.Name , IPAddress, DNSServerSearchOrder | Export-csv "C:\TEMP\DNSIP.csv" -Append
}
Error code below:
Export-csv : Cannot append CSV content to the following file: C:\TEMP\DNSIP.csv. The appended object does not have a property that corresponds to the following column:
PRODExcMbx01-VM. To continue with mismatched properties, add the -Force parameter, and then retry the command.
At C:\Users\Administrator\AppData\Local\Temp\4c40dff4-c8ba-4ab3-ad94-1e68d0c43a96.ps1:6 char:151
+ ... rSearchOrder | Export-csv "C:\TEMP\DNSIP.csv" -Append
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (PRODExcMbx01-VM:String) [Export-Csv], InvalidOperationException
+ FullyQualifiedErrorId : CannotAppendCsvWithMismatchedPropertyNames,Microsoft.PowerShell.Commands.ExportCsvCommand
and the result of the CSV is shown below:
#TYPE Selected.System.Management.ManagementObject
"PRODExcMbx01-VM","IPAddress","DNSServerSearchOrder"
,"System.String[]","System.String[]"
ASKER
thanks !
Will's needed the -ComputerName parameter for the Get-WmiObject command.