29
May
14

Remove-SPUser PowerShell Command: How to Use it in SharePoint 2013

I was trying to use the Remove-SPUser cmdlet and kept getting this error:

Remove-SPUser : You must specify a valid user object or user identity.

image

With claims based authentication the cmdlet Get-SPUser returns all users like this:

image

So, you can see the format of the –Identity (UserLogin) is something like this:

i:0#.w|DOMAIN\USERID

This thread referred to the Get-SPUser cmdlet and using New-SPClaimsPrincipal, but what I found was pretty simple.

http://social.msdn.microsoft.com/Forums/en-US/260ad45b-cfe7-4699-842b-fc2ecdf6e543/powershell-cant-getspuser-adfs-user?forum=sharepointgeneralprevious

Use this format for the cmdlet:

Remove-SPUser -identity "i:0#.w|cfgmgt\rwright" -web http://cmsp2013:5555

The trick for me was to put double quotes around the encoded user name.

Now, if the Microsoft documentation would be more accurate…

Advertisements

0 Responses to “Remove-SPUser PowerShell Command: How to Use it in SharePoint 2013”



  1. Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Asif Rehmani’s SharePoint Videos

SharePoint-Videos

Click to access a wealth of SharePoint videos

SharePoint Rx

SharePoint Rx Home

Categories

Posts by Date

May 2014
M T W T F S S
« Mar   Jun »
 1234
567891011
12131415161718
19202122232425
262728293031  
Support Wikipedia

%d bloggers like this: