I want to test for the existence of a computer account in Active Directory with PowerShell using only tools from Microsoft.
Using Quest AD cmdlets, I can do this:
if (!(get-qadcomputer $name)){ Stuff }
That doesn't work with get-adobject
or get-adcomputer
as far as I can tell.
Is there something simple that I'm missing? I've seen a couple hacky-looking solutions that trap all exceptions that get thrown, but that seems like it could give some false positives under certain circumstances.