none
Project Server 2016 : Add a user to a Project Group RRS feed

  • Question

  • Hi,

    Our environment is Project Server 2016 and we want to add users to a project Group with PowerShell.

    I have read an article about using the PSI in Project Server 2016. It is not supported. But it seems to be possible.

    I don’t know if it is really possible to use the WebSVCSecurity members. Could you tell me the library we must add ?

    Can someone explain me how to add an user to a Project Group ? It is very interesting for me to have an exemple.

    Thank you for your help

    Nicole EFANDA


    Tuesday, February 12, 2019 5:30 PM

Answers

  • Hi Nicole,

    I suggest you use AD Sync instead. We use a PowerShell script using it, to add users to a Project Group. I suggest you contact us to get one.


    Didier Maignan | http://www.e-labor.fr

    • Marked as answer by ENicole Wednesday, March 6, 2019 5:36 PM
    Wednesday, March 6, 2019 5:31 PM

All replies

  • Hello,

    The PSI is supported in Project Server 2016, it's recommended to use CSOM where possible but if you can't do what you need in CSOM then use the PSI.

    Paul


    Paul Mather | Twitter | http://pwmather.wordpress.com | CPS | MVP | Downloads

    Tuesday, February 12, 2019 11:40 PM
    Moderator
  • Hello Nicole

    Ditto with Paul's suggestions.

    Here is a link in the PowerShell gallery where someone has done this.

    https://gallery.technet.microsoft.com/projectserver/Add-Server-Users-to-Server-40aed317

    There aren't any straight up native command in PowerShell to do this.


    Michael Wharton, Project MVP, MBA, PMP and a Great Guy <br/> Website http://www.WhartonComputer.com <br/> Blog http://MyProjectExpert.com contains my field notes and SQL queries

    Wednesday, February 13, 2019 4:30 AM
    Moderator
  •                                            Hello, 

                  Thank for your help

                  M. Mather, I want to find an example with PSI to work on it and create my own solution. Do you know a link with some examples of PSI Code on Project Server 2016 environment, please ?

                  M. Wharton, I have tested this code given in the PowerShell gallery. But in Project Server 2016 the URL of the Web service does not exist yet

                  So I do not know how to add an user to a Project Group.

                  Do you know the DLL we must add to access to security groups in Powershell ? Is it possible ? Or is it a C# solution ?

    Nicole EFANDA 


    Wednesday, February 13, 2019 11:49 AM
  • The PowerShell example is a PowerShell function.  The function needs to be at the top of script and you have to pass it the URL, UserName and Group to the function when it is called.


    Michael Wharton, Project MVP, MBA, PMP and a Great Guy <br/> Website http://www.WhartonComputer.com <br/> Blog http://MyProjectExpert.com contains my field notes and SQL queries

    Wednesday, February 13, 2019 3:25 PM
    Moderator
  • Hi ENicole,

    Below is the piece of code for your reference using PSI to add a user to the security group.

    msprojectSecurity.Security msprojectSecurity = new msprojectSecurity.Security();
    msprojectSecurity.Credentials = CredentialCache.DefaultCredentials;
    using (msprojectSecurity.SecurityGroupsDataSet groupDs = msprojectSecurity.ReadGroup(SecurityGroupGuid))
    {
      if (groupDs.GroupMembers.FindByRES_UIDWSEC_GRP_UID(ResourceGuid, SecurityGroupGuid) == null)
      {
        msprojectSecurity.SecurityGroupsDataSet.GroupMembersRow groupMembership = groupDs.GroupMembers.NewGroupMembersRow();
        groupMembership.RES_UID = ResourceGuid;
        groupMembership.WSEC_GRP_UID = SecurityGroupGuid;
        groupDs.GroupMembers.AddGroupMembersRow(groupMembership);
        msprojectSecurity.SetGroups(groupDs);
        isUpdate = true;
      }
    }
    ----
    Rajkumar Allepu

    Monday, February 18, 2019 6:38 AM
  • Hi Nicole,

    I suggest you use AD Sync instead. We use a PowerShell script using it, to add users to a Project Group. I suggest you contact us to get one.


    Didier Maignan | http://www.e-labor.fr

    • Marked as answer by ENicole Wednesday, March 6, 2019 5:36 PM
    Wednesday, March 6, 2019 5:31 PM