Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Server 2003 domain issue - Need to use newer cmdlet

$
0
0

Hello,

We are trying to get a list of all our DNS forwarders. The bellow script works perfectly for our newer server 2008 forest run from a PS version that support this cmdlet. The problem I now have is my legacy domains. At first I thought it might be as simple as running a PS window on my windows 8.1 system as my legacy domain admin account but that didn't work. 

A colleague suggested I try using LDAP queries but I'm not certain I know how to incorperate this in my script

 

His suggestion:

([adsi]"LDAP://ou=domain controllers,dc=legacydomain,dc=legacydomain").psbase.Children|select dis*|% {$_.distinguishedname.split(",")[0].replace("cn=","")}

 

Can someone help me with this change or suggest an easier method?

---------

Script

---------

$IPGDCs = ls -Path 'AD:\OU=Domain Controllers,DC=domain,DC=domain,DC=com' | select -ExpandProperty Name

$mycol = @()

Foreach ($IPGDC in $IPGDCs){

                $Props = [ordered]@{

                'Name' = $IPGDC;

                'IPs' = $null;

                'UseRootHints' = $null;}

 

                $OBJ1 = New-Object -TypeName PSObject -Property $Props

 

 

 

                                $DCDetails = Get-DNSServerForwarder -ComputerName $($OBJ1.Name)| select UseRootHint,@{name='IPAddress';expression={$_.IPAddress -join ','}}

                                $OBJ1.IPs = ($DCDetails.IPAddress)

                                $OBJ1.UseRootHints = $DCDetails.UseRootHint

                                $mycol += $OBJ1

                }#End of foreach

 

                $Mycol|ft -AutoSize

$Mycol| select * | export-csv -Path c:\Scripts\IGDNSMap.csv -NoTypeInformation


Viewing all articles
Browse latest Browse all 6937

Trending Articles