
#Add-PSSnapin Quest.ActiveRoles.ADManagement

$csv = Get-Content "c:\Temp\OU.csv"

$result = $csv | foreach-object {
$group=$_
Get-QADUser -SizeLimit 0 -SearchRoot "DC=ud1,DC=utility" |Select-Object samaccountname, sn, givenname, @{n="ParentContainerDN";e={($_.ParentContainerDN -split ",*..=")[1]}} | Export-Csv users.csv
}
$result | export-csv c:\temp\OU_Result.csv -notypeinformation