Skip to content

Instantly share code, notes, and snippets.

@dsolovay
Last active June 4, 2024 14:28
Show Gist options
  • Save dsolovay/09b9ea453f950ebb1bae617c3915fdfd to your computer and use it in GitHub Desktop.
Save dsolovay/09b9ea453f950ebb1bae617c3915fdfd to your computer and use it in GitHub Desktop.
Get non-removed items from DB Cleanup log
param ([String]$LogPath)
$db = ''
foreach ($line in Get-Content $LogPath)
{
if ($line -like '*Cleanup of resource items is started for *') {
$db = $line -replace '^.*Cleanup of resource items is started for ''(\w+)'' database.*$', '$1'
}
if ($line -like '*item {*} is modified.*') {
$id = $line -replace '^.*item {(.{36})} is modified.*$', '$1'
[PsCustomObject]@{
"Database"=$db
"ItemID"=$id
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment