The problem here is that the propertie value for 'lastlogondate' is nonexistent (This has happened to me once or twice)
In the "about_Where-Object" it says " The Where-Object cmdlet selects objects that have particular property values from the collection of objects that are passed to it"
But it will pass all objects becaus the value is missing (as I suspect most of you know).
My question is. Is this a expexted behavior or a bug?
To me, it's a little bit like
If you have a parachute, I will throw you off the plane
If you dont have a parachute, I will NOT throw you off the plane
If I dont know if you hava a parachute, I will throw you off the plane!
Also worth noting is the reason you're not getting the 'lastlogindate' property is because get-adcomputer returns only a small subset of properties by default. This is by design, and to correct this use the -properties parameter of get-adcomputer to specify what additional properties you'd like returned for each computer object. Eg.