Calculating Total Size (Bytes) used by Record Types
Someone on the forums posted a question about how to calculate total volume by record type. Given that there is little capability to gather this information from the client, I figured I'd share my powershell script. It's included below!
Add-Type -Path "D:\Program Files\Hewlett Packard Enterprise\Content Manager\HP.HPTRIM.SDK.dll" Add-Type -Path "D:\Program Files\Hewlett Packard Enterprise\Content Manager\HP.HPTRIM.Framework.dll" $iseProc = Get-Process -id $pid $db = New-Object HP.HPTRIM.SDK.Database $rtSearch = New-Object HP.HPTRIM.SDK.TrimMainObjectSearch -ArgumentList $db, RecordType $rtSearch.SearchString = "all" $rtSearch = [HP.HPTRIM.SDK.ObjectSelector]::SelectMany($iseProc.MainWindowHandle, $rtSearch) foreach ( $rt in $rtSearch ) { [long]$totalBytes = 0 [long]$curRec = 0 $recs = New-Object HP.HPTRIM.SDK.TrimMainObjectSearch -ArgumentList $db, Record $recs.SearchString = "type:$($rt.Uri)" foreach ( $rec in $recs ) { $curRec++ Write-Progress -Activity "Inspecting $(([HP.HPTRIM.SDK.RecordType]$rt).Name)" -status "Record $($curRec)" -PercentComplete (($curRec/$recs.Count)*100) $totalBytes += ([HP.HPTRIM.SDK.Record]$rec).DocumentSize foreach ($rendition in $rec.ChildRenditions) { $totalBytes += ([HP.HPTRIM.SDK.RecordRendition]$rendition).Bytes } foreach ($revision in $rec.ChildRevisions ) { $totalBytes += ([HP.HPTRIM.SDK.RecordRevision]$revision).Bytes } } Write-Host "$(([HP.HPTRIM.SDK.RecordType]$rt).Name) Total Size: $($totalBytes)" $recs.Dispose() } $rtSearch.Dispose() $db.Dispose()
When you run the powershell script you'll first be prompted to select the record type(s) you want to inspect. You can either highlight one individual record type, tag multiples, or hit cancel. If you've selected a record type the script will iterate each sequentially and inspect the electronic object, any renditions, and all revisions.
A handy progress bar will indicate the progress through each record type....
Once it's all done with the calculations you'll see the output in the window...