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.
Thanks for the response. I thought I had stated that I had already tried the normal escape characters, and that it worked for everything except when trying to filter both single and double quotes. Perhaps I didn’t explain well enough. In the end I figure I will just have to do a secondary replace:
Just a thought, take it as you wish. I moderate a number of other language forums (PS is a secondary language for me), and have seen other previously helpful people -have even been guilty of it myself - get frustrated over time and begin helping less and berating people more for not doing what they feel is the proper amount of research.
Those who ask questions without research are always going to be there; you are either correct and they are lazy (it happens) or they are new and don’t KNOW what they don’t know, so searching is difficult. In the forums I admin, we suggest people do one of two things: help anyway, remembering that we were all on Day 1 once, or ignore the thread. To do anything else generally leads to a less than welcoming experience for the users.