Cleaning Conflict and Deleted files on DFSR replicated SYSVOL

Perhaps you’ve done an ADRAP and youve got an item about Conflict and Deleted having some latent files. You found the AskDS entry about Manually Clearing the ConflictAndDeleted Folder in DFSR. But they use ugly WMIC commands, you want to use PowerShell, because PowerShell is awesome.

get-addomaincontroller  -filter  *  |  %{
    Get-WmiObject  -Namespace  "root/microsoftdfs"  -class  dfsrreplicatedfolderinfo  -ComputerName  $_.hostname
}  |  ?{$_.replicationGroupName  -eq  "Domain  System  Volume"}  |  %{$_.cleanupConflictDirectory()}