Did you test creating a single test OU to validate the code? Try running something simple like this:
$OU = [adsi]“LDAP://DC=YourDomain,DC=com”
$CreateOU = $OU.Create(“OrganizationalUnit”,“OU=Test”)
$CreateOU.SetInfo()
The rest of the code is just looping through the CSV and replacing static values with variables from the CSV. Also, sometimes when posting code from the internet the quotes get messed up. Above, the code I copied has a different quote in front of LDAP versus the quote after DC=com, so I would just replace all of the quotes in the code inside the editor you are using.