Coming soon - Get a detailed view of why an account is flagged as spam!
view details
5
Get-ADComputer results are wrong
Post Body

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:\Scripts\ManagedBy.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?

Author
Account Strength
100%
Account Age
12 years
Verified Email
Yes
Verified Flair
Yes
Total Karma
66,614
Link Karma
30,920
Comment Karma
35,639
Profile updated: 3 days ago
Posts updated: 9 months ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
7 years ago