locked
Set-SPUser : You must specify a valid user object or user identity. RRS feed

  • Question

  • I execute the following powershell command 

    set-spuser "domain\user" -web $w.Url -Group "Global Portal Members"

    here domain\user is a valid ad account and I can look him up in the "Active Directory Users and Computers"

    However Powershell throws error

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

    t line:1 char:11
     set-spuser <<<<  "domain\user" -web $w.Url -Group "Global Portal Members"
       + CategoryInfo          : InvalidArgument: (:) [Set-SPUser], PSArgumentException
       + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletSetUser

    I can go into UI and add the very same user without any problem. why is powershell complaining that User is not valid?



    MSDNStudent Knows not much!

    Wednesday, March 28, 2012 5:30 PM

Answers

  • Somehow this forum is really lucky for me. I keep googling for answer and I don't find anything. then I post here and just after posting I google again.

    you know what ... this time I get the answer. I am using wrong commandlet 

    Right commandlet is 

    new-spuser -UserAlias "domain\user" -Web $w.Url -Group "Global Portal Members"

    it works!!! I am leaving the post here so that someone like me who is facing the same issue can get the solution from here.


    MSDNStudent Knows not much!



    • Marked as answer by MSDN Student Wednesday, March 28, 2012 5:37 PM
    • Edited by MSDN Student Wednesday, March 28, 2012 5:43 PM
    Wednesday, March 28, 2012 5:37 PM

All replies

  • Somehow this forum is really lucky for me. I keep googling for answer and I don't find anything. then I post here and just after posting I google again.

    you know what ... this time I get the answer. I am using wrong commandlet 

    Right commandlet is 

    new-spuser -UserAlias "domain\user" -Web $w.Url -Group "Global Portal Members"

    it works!!! I am leaving the post here so that someone like me who is facing the same issue can get the solution from here.


    MSDNStudent Knows not much!



    • Marked as answer by MSDN Student Wednesday, March 28, 2012 5:37 PM
    • Edited by MSDN Student Wednesday, March 28, 2012 5:43 PM
    Wednesday, March 28, 2012 5:37 PM
  • Thanks very much. That was exactly also my problem :)
    Friday, April 13, 2012 11:18 AM
  • Hi

    Thanks for getting it straight.   Help me too.

    Swanl


    Swanl

    Thursday, June 21, 2018 4:36 PM