1

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?

1 Answer 1

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"

Your Answer

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

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