Automating the world one-liner at a time…
“To ship is the choose.” That is the sad reality behind a number of the things that we regretted about V1. When we first started the project (a LONG time ago) we knew that we wanted to close the semantic gap between what admins thought and what they had to type. Imagine that you wanted to find all the processes that had greater than 15MB of workingset. Who the heck could type in the following:
PS> Get-Process |where {$_.Workingset –ge ?????}
What? You didn’t know that 15MB was 15728640 bytes? Yes you should have written:
PS> Get-Process |where {$_.Workingset –ge 1572850}
Wait – is that right?
NO! As I typed it in, I made a mistake. I thought I would leave it in to make the point. If you came across this line in a script would you have caught the mistake? I doubt it. Ok Ok – so you’re a genius – I asked the question wrong. Would the person in the next office have caught the mistake? Right - “no way!”
That is why we added shortcuts KB, MB, and GB
PS> 1kb 1024 PS> 1mb 1048576 PS> 1gb 1073741824 PS> 15mb 15728640 PS> 1kb+2mb+3gb 3223323648
This then allows you to type things like:
PS> Get-Process |where {$_.Workingset –ge 15mb}
Sadly we did this so early on that we thought GB was going to be enough. It wasn’t that long before we realized our mistake in not including TB and PB but at that point, we were up to our necks in feature prioritization and this never became higher priority than something else.
With V2, we decided to remedy this situation and we now support TB and PB.
PS> 1tb 1099511627776 PS> 1pb 1125899906842624 PS> 1kb+2mb+3gb+4tb+5pb 5633900804047872
(Want to double check our math? :-) )
To me, the interesting part of this story is the way we got this into V2. The fact of the matter is that if we had done feature prioritization, I doubt very much that we would have included this change. What happened was that a number of us were embarrassed by this mistake and just decided to do the right thing and fix it. In retrospect, I think it was exactly the right thing to do. The lesson here is that you have processes and you have judgment and that success is all about finding the right balance between these two.
Experiment! Enjoy! Engage!
Jeffrey Snover [MSFT] Distinguished Engineer Visit the Windows PowerShell Team blog at: http://blogs.msdn.com/PowerShell Visit the Windows PowerShell ScriptCenter at: http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx
So you chose your side on the KB vs KiB debate :p.
More relevant, the B part is technically the dimension of the value, not a multiplier. Say I wanted to get the Processes that have a PID greater than 1024... get-process | where {$_.id -ge 1kb } looks weird, no ?
Why didn't you go ahead and add exabyte (EB) while you were at it?
I wish more groups at Microsoft would just decide to do the right thing when it came to bugs and features. Too often it is prioritized by a system that doesn't include the "right thing" and the "right thing" is excluded because it isn't important. The thing is, these are the things that customers expect. If you ignore them, then you are shooting yourself in the foot by doing the wrong thing instead.
Glad you did the right thing and keep up the good work.
I heard that 640kb is enough for anyone :)
I know things are never as simple as they are in small companies but wouldn't that be a relatively minor change? I mean I'm no Bruce Payette but I am pretty savvy on the PowerShell syntax and it seems like a pretty straightforward change seeing as you already had support for KB, MB, GB.
Thanks Jeffrey. You and the PowerShell team are making an admin like me very happy with this kind of attention to detail.
> It wasnt that long before we realized our mistake in not including TB and PB but at that point, we were up to our necks in feature prioritization and this never became higher priority than something else.
Are you saying that you saw the issue, but couldn't be arsed to make what should be a three-line change?
And as Jeffery Hicks, you were already bitten by this, but you still didn't include all the suffixes known to mankind ?