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

Script fails when DN contains komma #3

Open
Martin-Bonn opened this issue Jul 14, 2022 · 2 comments
Open

Script fails when DN contains komma #3

Martin-Bonn opened this issue Jul 14, 2022 · 2 comments

Comments

@Martin-Bonn
Copy link

Hello,

I am using this module with great success, it is a tremendous help!

There is a hickup I ran into: When I want to see the ACL set on a user object, I get an error because the DN of the User contains a komma.

e.g. 'CN=Doe, John,OU=bar,OU=foo,DC=kmk,DC=intern'

Get-Acl : The object name has bad syntax
At C:\Program Files\WindowsPowerShell\Modules\cActiveDirectorySecurity\cActiveDirectorySecurity.psm1:268 char:29
+ ...     $Permissions = (Get-Acl -Path $Identity.DistinguishedName).Access
+                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Providing an ObjectGUID or piping an Object from Get-AdUser does not help, I still get the same error.

Looks like there need to be some escaping of the komma, but I don't know how you would go about this.

Cheers!

@oliveirt
Copy link
Owner

Hi Martin. Glad you are finding the module useful. This is a strange one as I thought it would have been something I would have tested at the time as it is a relatively common naming convention (for displayName if not always CN). It appears to be a bug introduced in either Get-Acl or ActiveDirectory (1.0.1.0), rather than in the module itself and appears to behave differently on different versions of Windows and PowerShell. For me it works from PowerShell Core (7.2.5) on Windows 10 20H2; but not from PowerShell 5.1 on the same machine. It does however work from PowerShell 5.1 on an old Windows 2012 R2 machine. Would the PowerShell Core option work for you - as don't know if I am going to have time to investigate a workaround anytime soon?

@Martin-Bonn
Copy link
Author

Thanks for investigating and getting back to me!

What a surprise bug in an outside component, those are the best... I am using Windows Server 2019 and Powershell 5.1

https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-windows?view=powershell-7.2 says "PowerShell 7.2 installs to a new directory and runs side-by-side with Windows PowerShell 5.1."

If that is true, that would work for me as a fix for the time being.

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