Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shadowGroups.ps1 // problem with comma in username #10

Open
StefanSa opened this issue Jan 15, 2021 · 3 comments
Open

shadowGroups.ps1 // problem with comma in username #10

StefanSa opened this issue Jan 15, 2021 · 3 comments

Comments

@StefanSa
Copy link

hi rich,
thanks again for this very helpful PAW concept, i hope you are doing well in the difficult times at the moment.
There is a requirement to change the username (cn) from "first name surname" to "surname, first name".
Unfortunately the script has a problem with the comma in between. Can you help adapt the script so that it works correctly both with and without a comma?

Thanks for your help and time.

@utsecnet
Copy link
Owner

utsecnet commented Jan 15, 2021

So would that mean your DN would look something like this: CN=Johnson, Rich,OU=Tier0,OU=PAWAdmins,OU=Users,OU=Merrick,DC=devsec,DC=local

Is that even possible??

@StefanSa
Copy link
Author

Rich, yes just right

@StefanSa
Copy link
Author

Hi Rich, i hope you are doing well.
i have to correct myself, it is possible to differentiate between users with no commas in their name, herewith:

        if($user.name -match ','){
        # a comma was found in the Name attribute value
          $dn = $user.distinguishedname
          $department = ($dn -split '[,\=]')[4]
          $locale = ($dn -split '[,\=]')[6]
        }
        else {
        # no comma was found in the Name attribute value
          $dn = $user.distinguishedname
          $department = ($dn -split '[,\=]')[3]
          $locale = ($dn -split '[,\=]')[5]
        }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants