I'm trying to write a quick script to discover things about my new domain, but I keep running into obstacles. I can't seem to find a way to suppress the error output from that module like I can in others by piping standard error (2>) to $null.
Ultimately, I'm trying to do this because this is a multi-domain forest, and I want to be able to find out which domain a user account is in easily.
Here's what I have:
$doms = get-adforest | select -ExpandProperty domains foreach ($dom in $doms) { get-aduser-Properties CanonicalName -Server $dom 2> $null | select name,CanonicalName }
That WORKS, and shows me where the user account is, but it also spits out an error for every domain that the user name doesn't exist, and I really want to find a way to suppress that. Anyone have any tricks?
(I'm really getting sick of your crap, AD Powershell team...your module really sucks, you know that?)