The world is not as polite anymore as it was years ago. People are forgetting what was called “good behavior / manner”. And Powershell is entering the world and starting to monopolize in the world of scripting languages.
I think Powershell should show some level of social responsibility. And today, I’m taking action to change it:
I, Ulf B. Simon-Weidner, propose hereby that Powershell should be forced to show more social responsibility. Therefore I propose two actions:
- Any command executed should, by default, set the –whatif parameter
(This would prevent the commands from executing, it’ll only tell us what it would do)- To really execute a command, the –please Parameter must be used, which will revoke the –whatif parameter.
Wouldn’t this be nice?
I imagine this as the same world, where when you try to do something, the UI experience is like this:
“Are you sure?” [yes]
“Are you really sure?” [yes]
“Are you really, really sure?” [yes]
Having personally been responsible for multiple domain-wide issues, there is no amount of “social responsibility” that will prevent a determined administrator from doing something dumb.
Though I will admit, I’m a big fan of the -whatIf concept… 🙂
Because the commands just aren’t long enough already…
No, not at all. The default function of an executable is to execute, not to ask permission. Cmdlets, functions, scripts, are all there to perform work. If you want to use whatif, use it. Don’t force contrary behavior on the rest of the world.
3. All shared PowerShell tools (scripts, functions, cmdlets, modules, and snap-ins should have help (with examples).
-OrElse in place of -Force?
James – this is not serious – I just didn’t think that a smiley is necessary 😉
Have you tried setting $whatifpreference?
$WhatIfPreference = $true
@June – PowerShell has great help built-in with examples.
Ulf,
The mode you describe is actually already supported by PowerShell: http://dmitrysotnikov.wordpress.com/2009/09/17/set-whatif-on-by-default/
Dmitry
Dmitry is pointing out that setting the -whatif parameter as default is already doable. http://dmitrysotnikov.wordpress.com/2009/09/17/set-whatif-on-by-default/
Don’t forget Thank You upon a successful completion.
Expicitly adding a “:)”
I suggest instead of -force, one could use a
-isaidPLEASE parameter.