So just at the moment I’m developing some custom policy resources for an Information Management retention/expiration solution for a client, and in the midst of testing I discover that some content items aren’t expiring as they should.
Why I Loved Powershell Today #1
I needed to check the values of some columns on content items which weren’t expiring, columns hidden or otherwise not shown in the UI…
cls Add-PSSnapin microsoft.sharepoint.powershell -ea SilentlyContinue $w = get-spweb "http://sp/sites/team" $i = $w.GetFile("Retained Documents/Bobs Document.docx").Item $i.Fields | ? { -not $_.Hidden -or (@("Exempt from Policy", "Original Expiration Date") -contains $_.Title) } | % { "$($_.Title) [$($_.InternalName)] = $($i[$_.InternalName])" } $w.Dispose()

Why I Loved Powershell Today #2
I needed to check that my custom policy resources, were actually really really registed in the farm…
cls [void][Reflection.Assembly]::LoadWithPartialName("Microsoft.Office.Policy") '- List Policy Features and Resources' [Microsoft.Office.RecordsManagement.InformationPolicy.PolicyCatalog]::FeatureList | % { write-host "Feature: $($_.Id)" $_.ResourceList | format-table Id, Type, Name -auto write-host "-----------------------------------------------------------------------" }

Published by