Using metrics to help validate an upgrade
When upgrading from one version to another, a typical project plan will include a task to verify the integrity of the data post-schema upgrade. Often times an administrator will run some simple searches to verify data integrity. For instance: compare the total number of records in the dataset before and after the upgrade. I've done just that countless times.
In the age of powershell this becomes significantly easier. We can leverage the Content Manager .Net SDK and perform base object searches dynamically. This obviates the need to have an administrator manually perform searches before and after an upgrade.
An upgrade report might include a table like this:
To generate the metrics for the above report you can execute this powershell script as a CM administrator with highest privileges (or as the CM service account). Execute the script before and after the schema upgrade.
Clear-Host Add-Type -Path "C:\Program Files\Hewlett Packard Enterprise\Content Manager\HP.HPTRIM.SDK.dll" $Database = New-Object HP.HPTRIM.SDK.Database $Database.Connect() $ObjectTypes = [enum]::GetNames([HP.HPTRIM.SDK.BaseObjectTypes]) | Sort $ObjectMetrics = [ordered]@{} foreach ( $baseObjectType in $ObjectTypes ) { try { $MainObjectSearch = New-Object HP.HPTRIM.SDK.TrimMainObjectSearch -ArgumentList $Database, $baseObjectType -ErrorAction SilentlyContinue $MainObjectSearch.SearchString = "all" $ObjectMetrics.Add($baseObjectType, $MainObjectSearch.Count) } catch [HP.HPTRIM.SDK.TrimException] { } } $ObjectMetrics | Format-Table
The output from this script gives you the raw numbers for any validation efforts.