0

How can I read the role name of current logged-in user in Sitecore PowerShell Module?

1
  • A note about the available commands: they work with the built-in Aspnet Membership. It has not directly integration with security information revealed through Identity Server. May 24 at 15:03

2 Answers 2

2

You can try below command -

Get-User -Current

You can try some options as well -

Get-User [-Identity] <AccountIdentity> [-Authenticated]
Get-User -Filter <String> [-Authenticated] [-ResultPageSize <Int32>]

Docs for references - https://doc.sitecorepowershell.com/appendix/security/get-user https://munirhassan.com/2021/10/17/powershell-scrips-to-get-sitecore-user-information/

2

To get all roles which are directly assigned to a Sitecore user, you can use the following Sitecore Powershell Extensions script

$user = Get-User "sitecore\USERNAME"
$roles = $user.Roles
$roles

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.