Unable to add members via Add-LocalGroupMember cmdlet RRS feed

  • Question

  • Hello all,

    I am trying to add a domain user to a local group via Add-LocalGroupMember cmdlet.

    While doing so, I am getting the below error.

    PS C:\Windows\system32> Add-LocalGroupMember -Name FTP_Root_Users -Members "Username"

    Add-LocalGroupMember : Cannot bind parameter 'Members'. Cannot convert the "Username" value of type "System.String" to type "System.DirectoryServices.AccountManagement.Principal".
    At line:1 char:52
    + Add-LocalGroupMember -Name FTP_Root_Users -Members "Username"
    +                                                    ~~~~~~~~~~
        + CategoryInfo          : InvalidArgument: (:) [Add-LocalGroupMember], ParameterBindingException
        + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,LocalAccounts.AddLocalGroupMember

    PS C:\Windows\system32>

    Any help please

    • Moved by Bill_Stewart Wednesday, July 26, 2017 7:32 PM Abandoned
    Wednesday, June 14, 2017 12:11 PM

All replies

  • annot convert the "Username" value of type "System.String" to type "System.DirectoryServices.AccountManagement.Principal".

    you need to pass the cmdlet the principal name instead of a string

    get-aduser -server myserver -filter {samaccount -eq 'username'} | add-localgroupmember -name FTP_Root_Users -whatif

    Wednesday, June 14, 2017 12:31 PM