Hopefully this is something stupid simple. I have been struggling with a customer that wants to rebuild their A.D. OU structure in several domains. They have hundreds of department IDs they want pulled from PeopleSoft, and they would like these used for the OU names (e.g. an eventual OU of 18639 - Account Managers)
The problem is their naming scheme is all over the place for IDs in PS. Names have just about every special character imaginable in them. The customer would also like the names to look exactly like they do in PeopleSoft, so no stripping. New-ADOrganization unit works just fine, I can escape special characters and create the containers just fine.
The problem comes in where I am pulling in a list of OUs, comparing with a list obtained from PeopleSoft, and creating any new OUs. While I can escape every other special character, I am unable to find a way to escape a double quote. So while New-ADOrganizationalUnit will create something like 45009 - Kitchen “Donut Shop” just fine, Get-ADOrganizationalUnit cannot find it, so it tries to recreate it. Then it fails on creation of course, as it already exists.