0

I am using 7.2 Sitecore version. There I need to fetch users using PowerShell script. I have tried multiple combinations or filters to run for instance -

Get-User -Filter *

I get an error saying - item key already been added. This is happening due to a specific user. It might be more than one users corrupted. I am not even able to access the user through user User Manager.

How can I fix this issue?

1 Answer 1

2

Try to access it though membership class. Example to grab all extranet users below.

    [System.Web.Security.Membership]::GetAllUsers() | Where-Object {$_.UserName.StartsWith("extranet")} |
Show-ListView -Property @{Name = 'FullName'; Expression = {(Get-User -Identity $_.UserName).Profile.FullName}}, 
    @{Name="User Name"; Expression={ $_.UserName} },
    @{Name="Email"; Expression={ $_.Email} },
    @{Name="Is Enabled"; Expression={ $_.IsApproved} },
    @{Name="Is Locked"; Expression={ $_.IsLockedOut } },
    @{Name="Created Date"; Expression={ $_.CreationDate} },
    @{Name="Last Login Date"; Expression={ $_.LastLoginDate} }

I would probably directly access database and try to figure out if there are corrupted users or duplicates.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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