Curated Examples
Preview stale computer cleanup
Use CleanupMonster to review stale computer cleanup without changing Active Directory.
This pattern is useful for the first pass of a computer cleanup engagement.
It is adapted from Examples/DeleteComputers.ps1.
Example
Import-Module CleanupMonster
$reportPath = Join-Path $PSScriptRoot 'Reports\CleanupComputersPreview.html'
$logPath = Join-Path $PSScriptRoot 'Logs\CleanupComputersPreview.log'
Invoke-ADComputersCleanup `
-Disable `
-Delete `
-ReportOnly `
-WhatIf `
-ShowHTML `
-ReportPath $reportPath `
-LogPath $logPath
What this demonstrates
- generating a reviewable cleanup report
- keeping AD changes disabled with
-ReportOnlyand-WhatIf - writing output to script-local folders