Author Posts

June 24, 2015 at 10:08 am

I have a couple of questions about decisions which were made regarding defaults (or lack thereof).

Anybody know why Format-Table doesn't default to -AutoSize? Everybody I know always uses this setting... unless they forget. Then they go "Doh!" and reissue the command with -AutoSize.

The other decision that baffles me is why we need to add [cmdletbinding()] manually all the time. I can't recall a single script or function I've ever written where I didn't leverage this. Is there some reason for making it a manual addition?

June 24, 2015 at 10:14 am

AutoSize blocks the pipeline, which creates the perception of slower performance. Dunno if that's why, though.

CmdletBinding was added in v2, I believe. It differentiates from older function types. Nowadays, I always use it also. But making it a default would break backward compat.

June 24, 2015 at 10:45 am

Both legit reasons. Thanks.

June 24, 2015 at 9:36 pm

Format-Table -AutoSize might be a good candidate for the $PSDefaultParameterValues preference variable. Here's a couple posts I wrote about it that will give your enough information to make -AutoSize the default: Add this to your profiles, and it'll always be set.