How can I read the role name of current logged-in user in Sitecore PowerShell
Module?
-
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.– Michael WestCommented May 24, 2022 at 15:03
Add a comment
|
2 Answers
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/
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