How to Manually Delete Old/Empty WSUS computer Group from Database

Recently i was trying to delete/Remove one of the old computer groups under WSUS Console - Computers - All Computers. This Group was an old group with no members/Clients or any pending approvals any more. I tried removing it from the GUI by Right licking the object and Delete but the server hanged and i got connection error as shown below.




This problem might occur in WSUS servers utilizing the internal DB which has several limits and with the huge number of updates and many groups you can face such issue.

To solve this problem and manually remove this Group you will need to work it from the database and edit couple of tables as follows:

  1. Make Sure to take a backup from your WSUS server and WSUS DB.
  2. Use SQL Management Studio to connect to Windows internal database \\.\pipe\MSSQL$Microsoft##SSEE\sql\query
  3. We will mainly remove the old records from tbtargetgroupand tbflattenedtargetgroup tables
  4. Run “select * from tbtargetgroup” to get the list of groups.
  5. Identify the TargetGroupID of one of the groups that you want to delete
  6. Run delete from tbflattenedtargetgroup where TargetGroupID = ‘<TargetGroupID for the group which is to be removed>’
  7. Run delete from tbdeployment where targetgroupid = ‘<Previous step ID>
  8. Run delete from tbtargetgroup where TargetGroupID = ‘<Previous same ID>’

This should take care of the deletion of these groups. Again its always required to ensure you have full backup from your DB.


7 Comments
Comments

7 comments:

Scott Brickey Says:

Pretty sure Microsoft will stop supporting you if they ever find out that you manipulated THEIR database. I say this knowing that this is the same policy that MS applies to other products like SharePoint and TFS... it is a reasonable assumption that it'll apply to WSUS (or SCOM/SCCM/SCSM/etc) as well.

Ahmed Nabil Says:

This is not manipulation. Its just performing the operation that failed from GUI to Express resource limitation directly from the SQL. These SQL commands were recommended by Microsoft Support team.

Hrodoy Khan Says:


Our Exchange Server Support Team provides emergency support and assistance. Our Exchange Server experts can log
on remotely to diagnose and fix just about any problem you may be experiencing, 24×7. Today’s advanced remote
desktop tools, which are included with Microsoft Windows Server OS, allow us to rapidly support Microsoft Exchange
just as if we were at your place of business.
Emergency Exchange Support
Emergency Exchange Remote Support

Scotty McKenzie Says:

If you don't want to manipulate the WSUS DB directly, you can accomplish this the long way:
1. Create a new Update View
2. Choose "Updates are approved for a specific group..." (then select the group of course)
3. In the update view, choose Approval: Approved, Status: Any
4. Select all > right click > Approve... > find the group and choose "Same as Parent" > Ok
5. Delete the group as per normal

Personally, I use a powershell script to do this which also cycles through subgroups.

Steph Stephanie Says:

I would like to thank you for the efforts you have made in writing this article. I am hoping the same best work from you in the future as well. In fact your creative writing abilities has inspired me to start my own BlogEngine blog now. Really the blogging is spreading its wings rapidly. Your write up is a fine example of it.
pos system

useroftheworld Says:

I am unable to connect using sql management studio

useroftheworld Says:

i am unable to delete a target group

step 5 results:

Msg 547, Level 16, State 0, Line 1

The DELETE statement conflicted with the REFERENCE constraint "FK__tbTargetI__Targe__15A53433". The conflict occurred in database "SUSDB", table "dbo.tbTargetInTargetGroup", column 'TargetGroupID'.

The statement has been terminated.

Post a Comment