Remove Deleted Users
Have you ever had a time when you quickly and without thinking too much or accidentally deleted the user objects (that you know are no longer needed) in Active Directory and then you said, 'Shoot, now I have some records in MPS database referencing an object that no longer exist in the Active Directory? If yes, keep reading.
For most parts, it is probably not going to affect anything until you want to remove that organization from your environment or you want to remove the mailsotre resource from the environment and you realize there are still objects consuming the resource but you can't remove them.
Now, the above assumes that those objects that you have deleted are no longer needed. If they are needed still, then you should look at how to authoritatively restore the Active Directory for that object instead. If not, then you can run the following procedure and this procedure will attempt to remove the mailbox resource management tied to that GUID as well as the Customer records in the Customer table in the PlanManager database. Please note that, this is provided "AS IS" with no warranties, and confers no rights. Use of the included samples are subject to the terms specified in the Terms of Use. And, you should know that you are using at your own risk. If you are not sure, please contact Microsoft. Also, this is applicable to HMC 4.5 only.
<request>
<data>
<preferredDomainController>ad01.hmc45.com</preferredDomainController>
</data>
<procedure name="DeleteDeletedUser" description="Delete a user and associated resource allocations" access="private" type="write" perfEnabled="0" saveDataForRollback="0" auditEnabled="0">
<procedureData>
<junkyard/>
<GUID>535966DB27CD494597DDC2C1BC7816F3</GUID>
</procedureData>
<before source="data" destination="procedureData" mode="insert"/>
<execute namespace="Exchange 2007 Resource Manager" procedure="DeallocateMailbox" impersonate="1">
<executeData/>
<before source="procedureData" sourcePath="GUID" destination="executeData" destinationPath="GUID" mode="merge"/>
<before source="data" sourcePath="preferredDomainController" destination="executeData"/>
</execute>
<execute namespace="Managed Plans" procedure="DeleteCustomerByGUID" impersonate="1">
<before source="procedureData" sourcePath="GUID" destination="executeData" destinationPath="GUID" mode="merge"/>
<before source="data" sourcePath="preferredDomainController" destination="executeData"/>
</execute>
</procedure>
</request>
Now, obviously the problem here is that you need to provide the GUID and you can't find the GUID from the Active Directory (because the object has already been deleted). So, you will need to find the GUID from the PlanManager database itself instead. To do that run the following SQL query,
Select REPLACE(CustomerID,'-','') AS GUID, CommonName, FROM [PlanManager].[dbo].[Customers] WHERE StatusTypeCode = 'EN' and CommonName is like '%<username/email>%'
Replace the above highlighted <username> with your the appropriate value and then it execute the above query. That should return the records matching and if multiple records returned, then find the one that matches to the user object you just deleted. Take the GUID column and use that value fro the above.
It is important you are ABSOLUTELY sure that this is the right value because if not, you may be removing the wrong record. So, please use the above at your own risk. To confirm the deletion is good, run the following,
Select REPLACE(CustomerID,'-','') AS GUID, CommonName, FROM [PlanManager].[dbo].[Customers] WHERE REPLACE(CustomerID,'-','') = '535966DB27CD494597DDC2C1BC7816F3'
The record returned should have a StatusTypeCode = 'DE'.
Coming up next, a script that helps you to determine if there is any MPS to AD Integrity problem.
Comments
- Anonymous
February 14, 2016
hai, I just want to tell you that I am just very new to blogs and seriously loved this website. More than likely I’m planning to bookmark your blog post .
You amazingly come with really good posts. Thanks a lot for sharing your blog Microsoft.
http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Palembang
http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Papua
http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Papua%20Barat
http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Pati
http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Pekalongan
http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Pontianak
http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Samarinda
http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Semarang
http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Serang
http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Sidoarjo
http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Surabaya
http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Surakarta
http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Tasikmalaya
http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Yogyakarta
http://www.lokerjobindo.com/search/label/Loker%20Jurusan%20Akunting
http://www.lokerjobindo.com/search/label/Loker%20Jurusan%20Asuransi
http://www.lokerjobindo.com/search/label/Loker%20Jurusan%20Teknologi%20Informasi
http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Administrasi
http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Akuntansi
http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Alfamart
http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Arsiparis
http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Artis
http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Astra
http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Asuransi
http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Auditor
http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Bank
http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Bank%20BJB
http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Bank%20BNI%20Syariah
http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Bank%20BRI
http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Bank%20Danamon
http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Bank%20Mandiri
http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Bank%20Indonesia
http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Bank%20BCA
http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Bank%20BTN
http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Bank%20CIMB%20NIAGA
http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20BUMN
http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Terbaru
http://www.lokerjobindo.com