.net - How to check is a user is in a Domain group? -
.net - How to check is a user is in a Domain group? -
i want check grouping membership of user. grouping taken ldap , inserted domain. moment tried this...
#powershell.ps1 $currentuser = [system.security.principal.windowsidentity]::getcurrent() $wp = new-object system.security.principal.windowsprincipal($currentuser) # have in domain grouping called 'dom_group' if ( $wp.isinrole('dom_group') ) { "expected true" } else { "unexpected false" } #unexpected false
unfortunately, works local groups.
how can check grouping membership of current utilize against domain grouping 'dom_group'?
your code work, must qualify grouping name name of domain: $wp.isinrole('mydomain\dom_group')
or $wp.isinrole('dom_group@mydomain')
.
.net windows security powershell
Comments
Post a Comment