The following query if run on the SCOM db will run the grooming on all the partition tables. There are 122 partition tables in SCOM 2012. This will run for each one of them as their Iscurrent value is set to 1.
declare @counter int set @counter = 0 while @counter < 122
set @counter = @counter + 1
print 'The counter is ' + cast(@counter as char)