none
resource update - inactivate resource that doesn't exist in AD anymore RRS feed

  • Question

  • hello forum members,

    i am trying to write code that goes through all resources and updates some custom fields. However, something must have been set up wrong because I am getting a lot of users who are no longer exist in the AD group that is synced to the security group in Project Server and my code keeps erroring out.

    can anyone recommend any code on how to inactivate users who no longer exist in AD?

     if (checkedOut)
                        {
                            SvcResource.ResourceDataSet updateDs = resourceSvc.ReadResource(resourceRow.RES_UID);

                            if (check here if resource is a valid resource)
                            {


                                updateDs.Resources[0].RES_CODE = "A" + rand.Next(1000, 9999);
                                Console.WriteLine("Update RES_CODE to " + updateDs.Resources[0].RES_CODE);
                                resourceSvc.UpdateResources(updateDs, false, false);
                                Console.WriteLine("Check in " + resourceRow.RES_NAME);
                                resourceSvc.CheckInResources(new Guid[] { resourceRow.RES_UID }, false);


                            }
                            else
                            {
                            }
                        }
                       


    tatiana



    Wednesday, July 30, 2014 4:45 PM

Answers

  • This question was answered by Paul MC2 here: 

    http://social.technet.microsoft.com/Forums/projectserver/en-US/4e0349a3-afad-43da-ada7-7889ac9c34a2/deactivate-users-who-are-no-longer-exist-in-ad-but-were-added-into-resource-pool?forum=project2010custprog

    thanks Paul!


    tatiana

    • Marked as answer by tatiana obrien Thursday, August 28, 2014 12:15 AM
    Thursday, August 28, 2014 12:15 AM

All replies

  • Hi Tatiana,

    The AD sync doesn't remove from Project Server users that are not anymore in the AD. It simply deactivate them.

    Thus I guess you have to insert a condition to exclude inactive users.

    The Reporting DB contains the field [ResourceIsActive] in the [dbo.MSP_EpmResource] table.


    Hope this helps,


    Guillaume Rouyre, MBA, MCP, MCTS |

    Wednesday, July 30, 2014 4:52 PM
    Moderator
  • Guillaume, thanks for your response.

    unfortunately, when i went to check on reporting db- i looks like i don't have any inactive users.

    this query below produced 0 results.

    SELECT COUNT(*)
      FROM [ProjectWebApp].[dbo].[MSP_EpmResource]
      where ResourceIsActive = 0



    tatiana

    Wednesday, July 30, 2014 8:32 PM
  • Just to clarify - some users maybe still active in AD , but do not belong to the AD groups that i am syncing. (Before i created the AD groups - i synced to all employees and now having hard time cleaning up users who should not be active). I thought once you connect Project Server to sync with specific AD group - it should deactivate all users who already in resources, but do not belong to AD group. Apperantly, its not the case?

    the error i am getting is " ProjectServerError (s) LastError=AdminNTAccountNotFound

    I wonder is there is a way to programmatically or using PowerShell to delete all resources so that i could resync without issues ?


    tatiana


    Thursday, July 31, 2014 6:55 PM
  • This question was answered by Paul MC2 here: 

    http://social.technet.microsoft.com/Forums/projectserver/en-US/4e0349a3-afad-43da-ada7-7889ac9c34a2/deactivate-users-who-are-no-longer-exist-in-ad-but-were-added-into-resource-pool?forum=project2010custprog

    thanks Paul!


    tatiana

    • Marked as answer by tatiana obrien Thursday, August 28, 2014 12:15 AM
    Thursday, August 28, 2014 12:15 AM