Please format your code as code using the code posting tool provided on icon bar of the post editor (second to last icon). Thanks.
You can use an array to store all OUs you like to query and a loop to iterate over this array
$OUList = @(
"OU=Test DC=Test ,DC=Test"
"OU=Test2 DC=Test ,DC=Test"
"OU=Test3 DC=Test ,DC=Test"
)
$Result = foreach ($OU in $OUList) {
Get-ADUser -Filter * -SearchBase $OU -SearchScope OneLevel -Properties SamAccountName, Physicaldeliveryofficename |
Select-Object SamAccountName, Physicaldeliveryofficename
}
$Result |
Export-Csv "C:\Office.csv
Live long and prosper!
(79,108,97,102|%{[char]$_})-join''