I'm getting a nightly feed from our HR system with user information. I'm trying to use this feed to create and maintain Active Directory. The folks that enter the data are a little less than consistent. I've seen ALL CAPS, all lowercase, and occasionally AmiXed BaG.
I can't fix the database because I don't own the data. I'm a lowly windows/linux guy trying to make the best of a bad situation.
I'm loading everything in from a CSV file, and removing parenthesis and escaping the apostrophes for the O'Malley twins.
$LAST = "'" + ($entry.last_name -replace "'","''" -replace "\(","" -replace "\)","") + "'"
I'm actually doing that replace command for everything I read in since some departments and titles have apostrophes in the names...but that's another thread.
I'm using (Get-Culture).TextInfo.ToTitleCase to fix the easy stuff and capitalize the first letter of each name:
$FIRST = (Get-Culture).TextInfo.ToTitleCase($FIRST)
$LAST = (Get-Culture).TextInfo.ToTitleCase($LAST)
$MIDDLE = (Get-Culture).TextInfo.ToTitleCase($MIDDLE)
I've written the code to fix names like MacGruber and McClung, but I'm having trouble finding where I've done it and how I've done it (I'm assuming I used regex). I'm curious if there are other problem names that (Get-Culture).TextInfo.ToTitleCase won't totally fix.
I have another concern. My script is going to run from the HR data....meaning, it could be triggered any time they make any change to the record. Once they make a change, they'll show up in the feed and my script will repush all fields from HR... I may try to build in a *manual override* flag somewhere, but don't know what attribute in AD I can use to store it or if it's worth spending time on coding it...
I'd like to see what other people do that are faced with this problem.
Thanks.