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.
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
Subreddit
Post Details
- Posted
- 4 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/PowerShell/...