newbie PS user here.
I'm using Get-ADOrganizationalUnit to return child OU's that I want as a string array. IE "ou1","ou2","ou3", etc. The example I found returns the data in a table form. I have tried using export-csv, but that did not work well at all! Here is what I am using to get the data:
$Items = Get-ADOrganizationalUnit -LDAPFilter '(name=*)' -SearchBase 'OU=aa,OU=bb,OU=cc,OU=dd,DC=AD,DC=contoso,DC=CA' -SearchScope OneLevel | Format-Table Name -HideTableHeaders
this returns:
ThisOU
ThatOU
AnotherOU
etc.
But I need it structured as "ThisOU","ThatOU","AnotherOU",Etc The string array will be used in another script to create a drop down list of OUs. Any assistance is GREATLY appreciated!
Get-ADOrganizationalUnitreturns objects, not text.