I have what should be a fairly simple script where it spits out computers that don’t have a “ManagedBy” user listed. The code is pretty straight forward
Get-ADComputer -Filter * | where ManagedBy -eq $Null > C:ScriptsManagedBy.txt
The Results look like I’d expect them to
DistinguishedName : CN=Computer1234,OU=Desktop,OU=Win7,OU=Workstations,OU=Computers,OU=cool,DC=mydomain,DC=com DNSHostName : Computer1234.mydomain.com Enabled : True ManagedBy : Name : Computer1234 ObjectClass : computer ObjectGUID : 5b917740-fdf8-46e7-9a4b-0334534534e5653 SamAccountName : Computer1234$ SID : S-1-5-21-165822833-1632583300-13730345345345-226510 UserPrincipalName :
But when I pull up the computer in AD it has a user listed for ManagedBy. What am I doing wrong?
submitted by /u/Pavix
[link] [comments]
The post Get-ADComputer results are wrong appeared first on How to Code .NET.