how to unregister bulk archives (older than n years) using batch script.
I would recommend taking at look at the MoveOldArchives.ps1 powershell script that can be found under program files (x86)\pipc\OSIsoft.Powershell\ExampleScripts
If you take a look at the script, it unregisters the archives, moves them to a new location and then registers the archives again. You could modify the script to not register the archives and not to move them. Also, if you need a quick way, PI SMT allows you to select multiple archives and unregister in bulk.
See Dan Fishman's reply above, he's exactly correct. You can either modify that PowerShell script to just unregister archives, or you can unregister archives in bulk in SMT by ctrl-clicking or shift-clicking the archives you want to unregister and then right clicking them and selecting "Unregister archive".
I made a quick and dirty modification of the MoveOldArchives PowerShell script so that it would only unregister old archives rather than move and register them, which I've attached to this post (named UnregisterOldArchives.ps1). You can go ahead and give it a try, if you haven't already taken Dan's suggestion and modified it yourself (or used SMT).
Hope that helps. And thanks Dan for your excellent solution!
Retrieving data ...