$DomainName = (gwmi win32_computersystem).Domain
$dn0 = $DomainName.Split(".")[0]
$dn1 = $DomainName.Split(".")[1]
$dn2 = $DomainName.Split(".")[2]

If ( $dn2 -eq $null )
{$OU = "OU=Domain Controllers,DC=$dn0,DC=$dn1"}
Else {$OU = "OU=Domain Controllers,DC=$dn0,DC=$dn1,DC=$dn2"}

csvde -l "cn" -r "objectClass=computer" -d "$OU" -f dclist.txt -U

 

 

==========================

Get-ADDomainController |select Name,Domain