I’m putting this here for reference, but the idea comes from Richard Siddaway’s blog post: Error trapping when getting AD objects. When trying to discover if a list of old VMs had AD accounts I was getting errors when the account did not exist: Get-ADComputer : Cannot find an object