DEV Community

Discussion on: PowerShell Tutorial (Especially for People Who Hate PowerShell)

Collapse
 
ertant profile image
Ertan Tike

Post is great. It's help me to understand that i miss a lot.

But.

I still hate power shell. Why? Because power shell is one of 2005-era MS fallacy. (Like Win-FS, Metro UI among other etc) They take something does not work very well and re-design from scratch to sail to new seas.

Idea behind shell is you have some of "executables" to do some things. You call these executables from shell or you can put in a script file or you can call they from other executables. Some of executables are preinstalled (like ls, cp, mv) and if you don't have that executables you can install them (like git, npm, etc).

Power shell "cmdlets" are not executables, they are some registered commands which you do don't know where they come from.

Lets say you want to set some firewall settings from shell. Try to find related "cmdlet" if you can.

Lets say you found the "cmdlet" and if is not registered or if it's not compatible with your OS good luck with that.

Lets say you can run "cmdlet" and if you do not know object model of firewall library, go read some msdn pages and return back.

This is a part of "cmdlets" of firewall;

Copy-NetFirewallRule
Disable-NetFirewallRule
Enable-NetFirewallRule
New-NetFirewallRule
Remove-NetFirewallRule
Rename-NetFirewallRule
Show-NetFirewallRule

now compare this with how git or docker commands work. ( Wait... "Disable-NetFirewallRule" and "Enable-NetFirewallRule" ? why my friend??.. why?... )

I understand power shell is written with good intensions and super idealistic ideas to put some standard but I think power shell is not written to replace daily shell work, it's written to execute some (written in tears) script files and automate something.

Worst thing is; if I have to automate something, I could prefer to write in C# with IDE support (auto complete, debugging, refactoring etc etc) not in power shell. Because they are sailing in same sea.

Maybe I get older and wrong, I don't know.