Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

5
Why is a <blank> entry treated as "0" and not $null?
Post Flair (click to view more posts with a particular flair)
Post Body

Starting with this: Get-PSDrive -PSProvider FileSystem (Running on a system with mapped drives)

If I run this it excludes lines missing data: Get-PSDrive -PSProvider FileSystem | Where-Object {$_.Used -ne 0}

But if I run this it doesn't: Get-PSDrive -PSProvider FileSystem | Where-Object {$_.Used -ne $null}

This has got to be a simple questions but it's details like this that stop me from understanding what public scripts are doing and getting better at creating my own. Why does an empty/blank value -eq 0 ??

UPDATE for posterity. I found an Interesting quirk. (Or I wonder if this is the root of the broken code u/ka-splam referred to?)

So just running the following line I get blanks for 'Used' and 'Free' for mapped drives.Get-PSDrive -PSProvider FileSystem

But if I run this line, I get '0' s for 'Used' and blanks (nulls) for 'Free', verified with the isnullorempty testGet-PSDrive -PSProvider FileSystem | Select-Object -Property * | Format-Table

Author
Account Strength
90%
Account Age
9 years
Verified Email
Yes
Verified Flair
No
Total Karma
4,174
Link Karma
215
Comment Karma
3,959
Profile updated: 3 days ago
Posts updated: 3 days 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
4 years ago