Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Adding a user trough the following PS command line works just fine:

Set-SPUser -Identity "Domain\LoginName" -Web $Web.Url -Group "GroupName"

The problem occurs when the user is deleted and then the above command executed again. No exception throw, but the user is not added. Closing the PowerShell console (or in the PS editor) and running again the command still doesn't work.

Any idea?

share|improve this question

1 Answer 1

If a user is deleted this method doesn't work as the Set-SPUser is used to:

Configures properties on an existing user. (Technet - Set-SPUser)

But if your user is deleted from SharePoint, but do exist in Active Directory you can add the user using New-SPUser:

New-SPUser –UserAlias "AD\JoDo" –displayname "John Doe" –web $Web.Url -Group "GroupName"
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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