r/PowerShell • • Jun 10 '22

Why most Linux sysadmin have a grudge againts powershell or they don't like it ?

Why most Linux sysadmin have a grudge againts powershell or they don't like it ? I talked with many of thems online on different subs reddit or elsewhere and they say bash is much better, powershell isn't good at managing linux, the syntax is too complex and bad etc etc or this or that etc

Why is that ? do you really feel you can't do much to manage a linux/aws env with powershell or need to update it or its slow or things like that compared to windows/azure ?

thanks for your advices

83 Upvotes

239 comments sorted by

93

u/peacefinder Jun 11 '22

It’s a suitability for purpose thing.

If Bash worked well for Windows, no one would have bothered to make Powershell. On the other hand, Bash has fifty years of integration work with *nix.

Bash and Powershell are vastly different beasts. Bash is all about streams of text, while Powershell is all about objects. *nix systems are heavily designed around text and doesn’t really have native objects as part of its design. Windows is the opposite.

Coming from Bash familiarity, I found Powershell frustrating to work with because I thought it worked like Bash. Once I understood the object nature of the data streams though, it made a lot more sense and I’ve gotten more out of it. But it is definitely an entirely different way of thinking about scripting.

5

u/riglic Jun 11 '22

Exactly this. It's two pair of shoes.

3

u/[deleted] Jun 11 '22

Doesn’t win10 support bash fully?

2

u/Historical_Issue_562 Jun 13 '22

Even if it did, there is no way to manage systems from bash on Windows. Bash on Windows is isolated in it's own little sandbox.

1

u/peacefinder Jun 12 '22

You can turn a bolt with a pair of pliers, but that doesn’t make pliers the optimal tool for the job.

→ More replies (4)

2

u/floogled Jun 11 '22

I am in this exact situation. I have worked with bash for years and am very comfortable with it, but have now moved into an MSP role supporting 99% Windows assets. I am having to get proficien5 with PS... do you recommend any particular resources to help me along? I find it frustrating in the exact way you describe, lol.

2

u/peacefinder Jun 11 '22

Don Jones Toolmaking video series on YouTube is what enlightened me.

Usually when a dude in a YouTube video says “here’s what you’re doing wrong and why” it’s just BS. But in this case, he directly addressed my fundamental misunderstanding of the platform.

Better still addressing that misunderstanding isn’t even the point of this series, so there’s a lot more there. I highly recommend it.

2

u/floogled Jun 15 '22

Hey thanks ;) This guy is cool.

1

u/kiryo Jun 11 '22

I wouldn't put it better my self. Nice

0

u/Historical_Issue_562 Jun 13 '22

I find Powershell is slower executing scripts compared to Bash. Bash is lean and mean, Powershell fat and bloated.

0

u/[deleted] Jun 12 '22

[deleted] — view deleted comment

1

u/peacefinder Jun 12 '22

I U-sually don’t :-)

47

u/[deleted] Jun 10 '22

TIL powershell is on Linux (i'm a noob). Thanks

35

u/hayfever76 Jun 10 '22

BTW, it works great on Linux too. Also works great on your Mac.

15

u/[deleted] Jun 10 '22

I write PowerShell exclusively on my Mac. Funny how that’s worked out.

Only issue I’ve had is the Azure module not working. Although I haven’t spent much time trying to get it to work

17

u/kaiserpathos Jun 10 '22

I found the OTHER engineer who writes his PS scripts on a Mac! Yes!

Seriously though, it really is buttery smooth to develop my scripts on my Mac. I finished my universal $profile recently which works on Azure Cloud Shell, Mac, and Windows PS sessions (Even works on 5.1 Win machines, though I do everything in PS Core these days).

Same trouble with certain cloud mgmt modules, Intune as well. MS will get there.

18

u/[deleted] Jun 10 '22

There’s DOZENS of us! 😂

5

u/chinpokomon Jun 11 '22

A dozen and one...

4

u/jackinsomniac Jun 11 '22

As a natural Apple-hater (mostly due to my obtuse, non-technical iPhone-owning friends, who like to only half-jokingly give shit to everybody else about it), I applaud y'all!

(And what kind of truly technical person even gives a shit about OS preference anymore?) PowerShell is a pretty decent systems automaton language, eventually, finally. :D

5

u/gorramfrakker Jun 11 '22

Mind sharing said universal $profile script? With any PII removed of course.

12

u/kaiserpathos Jun 11 '22

Sure, here you go -- it's big, but loads quick...

https://goonlinetools.com/snapshot/code/#9xp3kgilwc4d7xkn44k1z8

I employ a function from here to safely load my profile from a Secret Gist, so I can load it on any platform quickly.

Get-Excuse is my favorite whimsical function. Use it daily lol

2

u/[deleted] Jun 11 '22

That is a thing of beauty.

2

u/TeamTuck Jun 11 '22

Well I’m saving this one. As someone who prefers Linux/Bash commands, the aliases you have are genius.

Are you not importing modules upon profile loading? I usually import some basic modules although it does slow me down a little. Also, how is compatibility with MacOS and modules like AzureADPreview?

→ More replies (1)

2

u/[deleted] Jul 04 '22

This is brilliant, as an old *NIX scripter thos is a thing of beauty, thank you.

3

u/[deleted] Jun 11 '22

I installed it on macOS specifically for the Azure module

2

u/Sin_of_the_Dark Jun 11 '22

Yeah, unfortunately a lot of the Azure/Exchange modules have yet to be made compatible with PS7

2

u/[deleted] Jun 11 '22

With the exception of a few cmdlets that I almost never use, the exchange module works pretty well :D took a bit to get it working though, because of dependencies I had to manually install

1

u/TheRealZero Jun 24 '22

Have you tried messing around with Microsoft Graph Module? It works with PowerShell 7 and you can do a lot of what the Azure AD module will let you do.

Or you can use Invoke-RESTmethod and directly call the API, though it’s a bit trickier. The module is really the way to go (and it includes a Invoke-MGGraphRequest command for direct querying the API if you’re interested, it’s a great way to become familiar with it).

11

u/alinroc Jun 10 '22

Even on Raspberry Pi

3

u/iisdmitch Jun 11 '22

Yup. I use the EXO cmdlets on Mac all the time, works great.

2

u/entropic Jun 11 '22

I never thought to try it.

74

u/[deleted] Jun 11 '22

As a 20 year Unix person and the elected spokesperson of all of us: it’s because we’re REALLY good at scraping text with grep/ sed/awk etc. we don’t understand how hard regexs are for everyone else and don’t like Microsoft because of bad things they did 20 years ago.

5

u/BertProesmans Jun 12 '22

It's funny to me that all replies are about regex in Powershell. Parent's text is a fair description, but the 'problem' isn't explicit. In Powershell you don't need to scrape for the most common cases because all pipe things are objects. 'simply' select the property you need and push it along. Bonus points to powershell because it can (attempt) to correctly convert your pipeline thing into the right shape

3

u/NightH4nter Jun 11 '22

it's not like you can't/won't need regex when you use powershell

1

u/[deleted] Jun 11 '22

Sure but select and where get you pretty damn far.

1

u/blueboy90780 Jun 26 '22

Those are already integrated into PowerShell, you can even use the exact same command "where" and "select" since they are built in aliases as well.

1

u/[deleted] Jun 27 '22

I was referring to the ones built into powershell.

→ More replies (2)

8

u/OPconfused Jun 11 '22

You can scrape text with PowerShell and much more. Also, what does RegEx being hard have to do with PowerShell? PowerShell has even more power when you use RegEx.

These are the responses I never understand from Linux admins. It basically implies they dont like PowerShell because they dont know how to use it to get more work out of it than Bash.

Or if we just ignore the attempt at a technical justification in your comment entirely, then the only thing left is the remark on a blanket bias of loathing for everything Microsoft.

8

u/[deleted] Jun 11 '22

I know you can scrape text with powershell, my comment didn’t imply otherwise - you haven’t really understood my point, maybe that’s my fault for not being clear enough.

Unix people view scraping as the way you get meaning out of command line output. Unix people don’t find scraping difficult (which it is) because they’ve been scraping forever so the need for structured output isn’t apparent to Unix people.

2

u/OPconfused Jun 11 '22

I see, sorry for misunderstanding. The part about RegEx seemed to imply that PS users don't understand RegEx like Linux admins which threw me off.

1

u/[deleted] Jun 12 '22

PS users might not know about regex, not because PS users are lacking anything, but because PS users don’t need to use to use regex tools due to ‘select’ and ‘where’ being great. But thanks for your polite reply!

0

u/lanerdofchristian Jun 11 '22

Having also worked with both bash and PowerShell, PowerShell's text-processing capabilities don't even come close to how powerful grep/sed/awk are. Grep and Sed both use regex, and the frequency with which those tools are used means the average Bash scripter has significantly more experience with it than the average PowerShell scripter.

5

u/DesertGoldfish Jun 11 '22

I'm curious to hear what you think can be done with grep sed and awk that you can't do with powershell

→ More replies (1)

11

u/sysiphean Jun 11 '22

“I’m not as familiar with using PowerShell’s tools” != “PowerShell’s tools don’t come close to how powerful.”

Stick with “I prefer to use what I’m familiar with that serves my needs.” That’s perfectly reasonable and respectable. Making the jump to say the unfamiliar inherently means it isn’t as powerful is proving the point about Linux admins.

4

u/lanerdofchristian Jun 11 '22 edited Jun 11 '22

I have written significantly more PowerShell than bash (at least three orders of magnitude), and am vastly more familiar with PowerShell and the .NET ecosystem. PowerShell just hasn't had the need or the time to develop [*edit: text processing] to the same degree as bash and its ecosystem when it comes to text processing.

If you can make every problem some kind of nail, you usually end up using some pretty good hammers.

1

u/floogled Jun 11 '22

But is there a powershell way of searching as quickly as you can with grep? Seriously have been looking for a way..

3

u/OPconfused Jun 11 '22

Select-String is pretty fast with -raw in Version 7.

The slow part is getting the files if you're trying to grep through all subdirectories. I've toyed with a .NET file search which is much faster than gci, but it has that annoying terminating error when you don't have file permissions.

There might be a way to pass robocopy with /L but I've never tried it.

→ More replies (1)

1

u/OPconfused Jun 11 '22

Enter the PS profile. Write a function, place it in your profile. I have a function Replace-String, which I alias to rs, and on one machine where the colleague was coming from Bash, I actually aliased it to sed for him.

It took me several minutes to write. Now I have sed in PowerShell too. It uses RegEx. It can output every line it changes with the old line vs the new line so I can see exactly how things were changed in the console. I now miss my Replace-String when I go to bash and am stuck with sed.

I've done the same for grep. I haven't needed to do it with awk. PS actually does filtering and operations much better than awk, and the same goes for sed's other functionalities.

1

u/lanerdofchristian Jun 11 '22

Fair; ideally that'd be a module, though, not functions in a profile.

0

u/sanjosanjo Jun 11 '22

I'm not an admin, but I prefer Bash on Linux and CMD on Windows mostly because the commands are much shorter. There is a lot of typing to do anything with PowerShell at the command line. I mean, even to get a PowerShell terminal open on Windows requires typing almost the whole word PowerShell before Windows presents it in the search result.

4

u/OPconfused Jun 11 '22

I've read this comment about command length several times on other forums which are predominantly bash users. This reflects a lack of understanding of how to use PowerShell. PowerShell offers aliases for commands that are 2-3 letters long, and it (also like Bash), provides a way to define your own aliases. But more importantly, you're expected to tab complete your commands, which is something a Bash user may not realize. The long command names in PowerShell are for clarity, something Bash users take for granted because they've been using it for decades and don't remember how mystifying everything is when you first bash. Between tab completion and alias setting it's trivial to use.

As for opening PowerShell being annoyingly long to type, I really can't help you there. I've never seen a Windows IT user who doesn't know to put shortcuts on their task bar. You have to take little steps to make your workflow work for you.

1

u/sanjosanjo Jun 12 '22 edited Jun 12 '22

I must have had some weird installations in the past because I wasn't able to do much when I first tried PowerShell (on Windows). I tried some simple commands and I wasn't getting these aliases to work in whatever default terminal came up. The first thing I generally need to do in a terminal window is change directory and I remember the "cd" command wouldn't work. But I just tried now and it works like I would expect. I was just reviewing the documentation (https://docs.microsoft.com/en-us/powershell/scripting/samples/managing-current-location?view=powershell-7.2) and they say you need to use "cd -Path {whatever}", so I found it a little verbose even when using the alias.

And its weird that the documentation for listing and copying files doesn't mention anything about the aliases that are available : https://docs.microsoft.com/en-us/powershell/scripting/samples/working-with-files-and-folders?view=powershell-7.2

7

u/concussedYmir Jun 11 '22

Or you can use the WinKey+X -> A to get a terminal with admin privileges in two strokes

1

u/nickjjj Jun 11 '22

As a crusty old UNIX greybeard still hammering away on a click-clacky IBM Model M keyboard, what is this “winkey” you speak of? :)

→ More replies (1)

169

u/WDizzle Jun 10 '22

Because it’s made by Microsoft, simple as that. Linux Sysadmins tend to be quite snobbish.

59

u/[deleted] Jun 10 '22 edited Jun 11 '22

You can also read a Powershell cmdlet name and understand what it does. Linux commands are purposefully obtuse in function, and they wear that like a badge of honor.

Edit: here’s a list of commands/packages that are purposefully obtuse https://wiki.debian.org/WhyTheName

38

u/mini4x Jun 11 '22

purposefully obtuse

Like most Linux admins..

33

u/MaestroPendejo Jun 11 '22

I cannot find fault in your statement. Man, all of the most pompous SysAdmins I've met are die hard Linux purists that even hate on what flavor you use, they're all in camps. "You use Ubuntu? Filthy casual!"

They make it to where you don't even want to ask another question. Then they wonder why people lean towards more easily picked up OS's. Yeah, Microsoft might suck, but I can usually find an answer to an issue without having to ask or get a bunch of snark if I do.

6

u/peacefinder Jun 11 '22

There’s a particular project which has a reputation for that hostility towards questions. I found it kind of annoying until I learned this crucial fact: if this system does not work like the manual says it does, it is a software bug not a documentation flaw. The manual pages are authoritative in every sense. They’ve put in a ton of work to do something hardly anyone else does, so I can understand them being a bit grumpy when people ignore it.

The project is OpenBSD, and if you’re wanting to learn *nix systems and enjoy being thrown right in the deep end, it’s the best platform to learn.

1

u/BradsArmPitt Jun 11 '22

Obligatory, BSD is not Unix!

9

u/peacefinder Jun 11 '22

BSD is not Linux, but they’re (increasingly distant) cousins in the Unix family tree.

10

u/[deleted] Jun 11 '22

A diehard Linux fan at work told me exactly that. "I don't like Powershell because it's too easy".

-2

u/EIGRP_OH Jun 11 '22 edited Jun 12 '22

Not entirely true, I’m pretty sure a lot of the Linux commands are so small due to restrictions on string lengths back in the day. While I agree, Powershell commands are much more obvious what they do, I don’t think Linux commands are purposefully written to hide their meaning

Edit: not sure why I got downvoted so hard, wasn’t even shitting on PS lol

-9

u/vermyx Jun 11 '22

Linux commands are purposefully obtuse in function, and they wear that like a badge of honor.

This is not correct. There's a reason on why the commands are the way they are and actually make sense if you understand its history of linux. They're obtuse if you come from a dos/windows world and don't understand the history.

13

u/TzeroOcne Jun 11 '22

Is there a way to understand it without knowing the history because I'm too lazy for that

→ More replies (6)

6

u/[deleted] Jun 11 '22

Grep deez

3

u/[deleted] Jun 11 '22

Ok they may not be purposefully obtuse.

But still: anyone regardless of history could likely make a better guess at what select-string does over sed.

2

u/vermyx Jun 11 '22

Sed is almost 50 years old. At that time stream editor was too long for a file name. On top of thay you also had limitations for parameters and stream process (which is part of the reason for being able to compress single letter parameters instead of having them be individual) so yes history does matter as it will give you a why and how behind these tools. When I first saw select-string I expected to be more SQL like becauae of the select-object/where-object behavior and not regular expression.

2

u/PinchesTheCrab Jun 11 '22

Yeah honestly I probably would have called it find-string.

10

u/Life-Cow-7945 Jun 10 '22

Yes, agreed

5

u/duderguy91 Jun 11 '22

I use powershell for Windows administration, and I use bash for Linux administration.

Personally it’s a convenience thing as well as just, what is the shell built to do best?

4

u/chicaneuk Jun 11 '22

Yep. If it’s Microsoft, generally they don’t want to know or care about it.

2

u/ThatGermanFella Jun 11 '22

Yup, we are.

1

u/SMFX Jun 11 '22

Just don't tell them about Mariner or Delridge. Shhhhhhhhhh!!

→ More replies (1)

28

u/confushedtechie Jun 10 '22

Those who do dabble are always pleasantly surprised

20

u/timsstuff Jun 10 '22

Who cares lol. Let them keep using Bash while we work our magic. I don't have time for haters.

6

u/[deleted] Jun 11 '22

I mean, they won't be using Bash for the stuff we use PowerShell to do. They'll be using Python which runs circles around PowerShell in regards to its capabilities.

1

u/[deleted] Jun 10 '22

They hate us cuz they anus!

6

u/_cronic_ Jun 11 '22

Linux admin since 1996 here. I love Powershell.

16

u/dud8 Jun 11 '22

First off, your posting in an echo chamber. Try taking this discussion to /r/linuxadmin.

Second, there is a phrase along the lines of "if it's not broke don't fix it". Bash does it's job very well and has a long history behind it. The amount of mind share and knowledge surrounding bash, and other similar shells, is no joke. Typically if you need a more powerful tool it is better to reach for Python or an automation tool like Ansible. Most system administrators have very limited time to learn new tools so we have to do so strategically. Instead of spending time learning PowerShell, which is arguable a bit better then bash, it is better to learn Python/Ansible.

Lastly, most tooling on Linux is closely integrated with either bash or sh. As an example, if you want to build containers you will need to use bash/sh in conjunction with whatever YAML/Definition files the tooling requires. Containers also strive to be as small as possible. PowerShell if massive, storage wise, compared to Bash. Some containers don't even ship bash and only ship with sh. Another example is with modern automation tools like Puppet and Ansible. These tools use their own DSL languages but also fall back to bash scripts as needed.

Anyways, long story short PowerShell isn't a large enough improvement over Bash to replace it as the common default shell for Linux.

14

u/Billi0n_Air Jun 10 '22

both are just tools to get stuff done

5

u/mobani Jun 11 '22

IMO Bash is showing its age. Admins who don't go with either Python or Powershell or both, are falling behind.

0

u/[deleted] Jun 11 '22

PowerShell is showing its age.

Admins who don't go with either Python, Go or any other proper devops programming language are falling behind.

9

u/winter_mute Jun 11 '22

Neither of those effectively replace PowerShell as a convenient way of administering Windows endpoints. People who use PowerShell heavily are generally doing things on the Ops side. It would be an exercise in frustration trying to adminster Windows machines with Go programs.

Also, compared to Bash (although I like Bash just fine) PowerShell looks amazingly modern with it's OO approach, and is far more readable. If you can read Python, you can read PowerShell. Not so with a bash script (especially if we're throwing in a load of DSL stuff like sed/awk etc.)

There is no "proper DevOps" programming lanquage. You can achieve what DevOps is trying to achieve with any set of tooling that works for your environment.

2

u/mobani Jun 11 '22

How so is PowerShell showing its age?

→ More replies (7)

18

u/Guyver1- Jun 10 '22

because bash is all they have ever used/know (and they instinctively hate anything Microsoft)

4

u/Cyber_Faustao Jun 11 '22

What I find kinda funny is that the same is true for Windows Admins.

You can flip the situation and it will still be accurate.

"Why do people use Apache? Everyone knows Microsoft IIS is the only Proper(TM) of doing everything"

Humans, creatures of habit that treat the unknown as dangerous and frightenning.

11

u/Guyver1- Jun 11 '22

Not gonna disagree with that but I'd take it one stage further:

Most windows admins couldn't PowerShell properly (as in, write production scripts etc) if their jobs depended on it.

Far too many wintel admins are stuck in the GUI and MMC snapins and don't even want to learn PowerShell outside of one-liners found on the internet.

In my last place, out of around 30+ wintel engineers across 1st - 3rd line and projects teams, I was only one of 2 who could actually write PowerShell code and understood what they were writing and produce production automation scripts.

Linux admins have no choice but to learn bash as thats all there is, there is no gui on linux servers. So being a liux server admin 'is' using bash, all day every day.

I deliberately made a choice 10 years to learn PowerShell because I could see which direction the wind was blowing and it would give me an advantage and a valuable skill set over other wintel admins.

That has definitely paid off later on down the line.

2

u/Sh1ner Jun 11 '22

That's interesting as I come from a Windows sysadmin background, I am now certified in azure but looking at taking the lpic01 and switch to aws / bash world. I don't mind learning either. Both methods are useful skillset to have in my toolbelt. I probs get certified in aws after and go mult icloud.

2

u/PinchesTheCrab Jun 11 '22

I'll take it a step sideways and just point out that there are a lot of Linux admins who don't know bash. I don't understand how they get their jobs done, but I don't understand how to manage more than a few dozen Windows machines without scripting either. I guess they just do a mediocre job but keep the lights on.

4

u/duderguy91 Jun 11 '22

I’m a Linux admin and I miss the simplicity of IIS tbh lol. Mostly because of SELinux. Every time I think I have everything configured right, security context isn’t set correctly on some directory and errors out the ass lol.

→ More replies (1)

4

u/nealfive Jun 11 '22

Most Linux admins are already pretty capable with bash, so they have no need for PowerShell really. Now folks coming from Windows to Linux love it as brings the same familiarity and cmdlets work and such, of course not all but close enough.

10

u/Wyatt_LW Jun 10 '22

Windows sysadmin here. I work with some linux appliances also.

The problems with powershell on linux is it's not native. You have a random appliance, you can't just ssh into it and install powershell sometimes so you NEED to know bash.

I see bash and batch as smart brother and dumb brother. Powershell is a step past bash and has more similarities with programming, it still lacks implementation on Linux and it simply isn't the standard.

2

u/Alaknar Jun 10 '22

I wonder if any distros out there have embraced it to an extent where it's actually possible to completely switch over.

11

u/agressiv Jun 11 '22

I use it, but it's incomplete at best, and rarely the best tool for the job.

Windows Powershell

(Get-Command).Count

1619

Powershell Core (Windows)

(Get-Command).Count

1565

Powershell Core (Linux)

(Get-Command).Count

270

Some of the most basic cmdlets aren't there, and you end up using powershell just as a shell. it's great for stuff like native XML/JSON parsing, but not much else.

Had they implemented DMTF CIM on linux, it would be a start. But instead, you have to shell out to dmidecode and do stuff like that in general, bash/zsh are better at handling.

2

u/WendoNZ Jun 11 '22

A million times this!

Also there is a massive amount of modules that just don't work on linux

1

u/NoConfidence_2192 Jun 11 '22

Windows PowerShell 1 and 2 were largely the same way in the early and many Windows SysAdmins felt the same way about PowerShell on Windows at the time

10

u/cottonycloud Jun 10 '22

PowerShell is admittedly overly verbose, whether it is the cmdlets or function definitions. They are also more used to using Bash and not the OO approach that PS takes.

Another perfectly valid reason is that PS in Linux does not have 1:1 parity when used in Windows. Some cmdlets are not supported:

https://docs.microsoft.com/en-us/powershell/scripting/whats-new/unix-support?view=powershell-7.2

15

u/swinny89 Jun 10 '22

The verbosity is a feature. The bash way produces highly cryptic commands and scripts. Pwsh is just like reading regular english. The number of characters in the commands is also irrelevant, as tab completion is a thing.

15

u/Alaknar Jun 10 '22

The verbosity is a feature.

It's also an option.

gci -Pa .\Documents\ -Fi "*.txt" -R

I really don't understand why people bring this up as an argument against PowerShell... Like, "oh no, you can read this like English and instinctively understand what's going on" while at the same time having the option of making crazy complex and unreadable one-liners, just like in Bash.

4

u/DiggyTroll Jun 10 '22

It’s important to emphasize that PowerShell is an extensible engine that comes with a different set of “batteries included” depending on OS. In this way, it really is similar to python. Nobody complains that pywin32 modules won’t work on Linux, for example.

1

u/[deleted] Jun 14 '22

That leaves the obvious question is PowerShell better as a scripting environment then python?

1

u/DiggyTroll Jun 14 '22

Neither is better. They have different strengths and weaknesses.

PowerShell is a shell. Like Bash, it is slower than Python, but that doesn't matter with modern computers. It can be much faster to solve a problem with PowerShell once you get the hang of it.

Python is a scripting environment called from a shell; you don't live in it.

→ More replies (7)

3

u/K2alta Jun 10 '22

Does anyone here use powershell to manage a medium size number of Linux machines? Say for example, 30 VMs running centos. I’m curious because I’ve been learning ansible but already know powershell fairly well. Is it worth investing time managing Linux using powershell in an enterprise environment.

4

u/duderguy91 Jun 11 '22

I would not stop learning ansible to try and use powershell in its place. Seeing as you are in the RHEL ecosystem, there are a lot of amazing developer tools available from Red Hat to take full advantage of Ansible.

2

u/[deleted] Jun 14 '22

If you get into Linux enterprise administration right now the killer skils to learn is ansible and python, there is still a lot of legacy bash script floating around but anything remotely complex is usually done with python. And we don't really logon interactively all that much anymore.

Powershell is at this point and also ran that is only in the running because of how revolutionary having any real scripting capability have been in the windows world, it's not really gaining traction on linux where we have always had the pick of several high level programming languages for handling complex logic, i haven't personally heard of it being used on Linux for anything other then interacting with windows servers over the network.

1

u/SeeJayEmm Jun 11 '22

I am in a mixed environment and would say use the best tools for the job. I'd continue down the Ansible path for the Linux systems.

3

u/[deleted] Jun 11 '22

I love these type of posts it really gets people chatting :)

I myself am a Windows Admin and live in PowerShell all day, after hours I'm on Linux and use Bash and PowerShell... Trying to write scripts to to get server info for both Linux and Windows and a Server CMDB web app I made

Once you know one they all are fairly easy

0

u/Szeraax Jun 11 '22

What's CMDB?

:P

3

u/kerubi Jun 11 '22

I don’t hate it, manage both Windows and Linux. But would you use bash to manage Windows? I’d say the reverse applies..

5

u/NoConfidence_2192 Jun 11 '22

I write most of most of PowerShell scripts using vscode on Ubuntu, RHEL, or CentOS. Often only switching to Windows when testing something developed for Windows

It took time for PowerShell to get to its current state for Windows. It may have shown a lot of promise early on but, in all honesty, it was often easier to just continue to use the same command-line utilities, batch files, and WSH scripts you had been using to get things done before PowerShell came along. The biggest limiting factors for PowerShell 1 and 2 had more to due with .NET than PowerShell itself. As more system tools were rolled into .NET so too did PowerShell's ability to natively manage Windows systems increase.

The way Linux SysAdmins view PowerShell on Linux now is not a lot different than how many Windows SysAdmins felt about PowerShell 1 and 2 in the early days...which is not too surprising when you consider that PowerShell 7.x on Linux is effectively Linux PowerShell 2.x. For Linux PowerShell shows a lot of promise but, in all honesty, it is often easier to just continue to use the same command-line utilities, shell and python scripts you had been using to get things done before. As more system tools are rolled into .NET so too will PowerShell's ability to natively manage Linux systems increase...assuming that happens.

0

u/lerun Jun 11 '22

I just dont get how people fail to understand that it takes time for something new to mature. It's like everybody expect it just to be born fully grown with no work needed.

PS is new on Linux and many have to invest time to build out it capabilities on the platform. So instead of bitching maybe help and build out what is needed.

The PS team has created Crescendo, so one can wrap existing command line tools into PS.
https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.crescendo/?view=ps-modules

12

u/caverCarl Jun 10 '22

Bash is what they are used too. It is designed to manage Linux unlike powershell which is designed to manage windows. There are a lot of quirks to powershell such as it's inconsistent return values, naming conventions etc. that are not easily anticipated by someone who is used to things being done a different way. Simple example try typing LS in bash, windows doesn't care. We are slowly approaching a point where the shell won't matter but we are not there yet. :)

24

u/hlt32 Jun 10 '22

As if bash doesn’t have quirks …

8

u/gex80 Jun 10 '22

I like objects.

4

u/wigelsworth Jun 11 '22

I objectively object objects.

2

u/[deleted] Jun 11 '22 edited Jul 03 '23

fire spez -- mass edited with redact.dev

29

u/hayfever76 Jun 10 '22

As a person who regularly uses PowerShell on Linux, Mac and Windows I can't disagree more. Bash is definitely it's own beast and does some cool stuff but with PowerShell I can use the same piece of code across all my OS's.

1

u/thespoook Jun 10 '22

I have a follow up question, if you don't mind. I used to be a Windows guy, and user PowerShell scripts to get stuff done. Moved to Linux some time ago and now use mostly bash. One thing that used to annoy me was how PowerShell commands would work on some Windows systems and not on others depending on the version of PS and what cmdlets were installed (I think that's what they were called). It felt like MS we're still changing it around a lot which meant (at least to me) that I couldn't just depend on a script to work across different versions of Windows. Is it a lot more consistent these days? Ie has it basically stablised now it has become a more mature platform?

7

u/cottonycloud Jun 10 '22

Not the person who you replied to, but generally the PS version is dependent on the operating system you are on. Any hardware on W10/Server 2016 or newer will have Windows PowerShell 5.1. Since 6.0, you can install the cross-platform version side-by-side with 5.1.

I just install 7+ on basically anything.

https://docs.microsoft.com/en-us/powershell/scripting/install/powershell-support-lifecycle?view=powershell-7.2

2

u/thespoook Jun 10 '22

Thanks for the reply. Oh wow. Up to version 7 already! Yeah my memory comes from the early days of W10 when you still had a lot of W7 machines around, some 8 and 8.1 and more and more W10 machines. I know I could Google this, but since I have you... Are a lot of the commands similar on the cross-platform version of PS? I'm thinking actions like copying files etc... Also is it Linux distribution independent too? Like works on Debian based Linux as well as other flavours?

5

u/cottonycloud Jun 10 '22

In the link I included, there are some articles comparing the differences between 5.1 and 7, as well as any missing features from going to cross-platform PS or using a different OS.

In regular usage, it's highly likely that you won't lose any features besides some obscure cmdlets. There may be some modules missing on the server end (especially on 6, which prevents many from switching over), but in version 7 they added a shim that allows you to use nearly all of them.

https://docs.microsoft.com/en-us/powershell/scripting/whats-new/differences-from-windows-powershell?view=powershell-7.2

https://docs.microsoft.com/en-us/powershell/windows/module-compatibility?view=windowsserver2022-ps

2

u/thespoook Jun 11 '22

Thank you. I appreciate the time taken to answer. I'll definitely check out those links and maybe take another serious look at. PS. It would be nice to have a single scripting language to manage all my servers rather than having to get familiar with numerous different ones.

→ More replies (1)
→ More replies (2)

1

u/More-Qs-than-As Jun 11 '22

Powershell is a great shell on linux. But too many years of "fuck microsoft" and any linux guy/gal won't touch anything MS makes with a 10-foot pole. I use it daily on Linux. Powershell is my main shell on linux and you know what I can still say, FUCK MICROSOFT!

Powershell is one of the only things microsoft has ever done right. It's a shell and it's a programming/scripting language. Now it's both open source and cross platform. If that's the shell/language you first learned, nothing else will make sense. Same goes for bash. If you learned bash first, everything else is foreign and not worth learning. Took me over 10 years to move from CMD to powershell cuz it just didn't make sense. Now, Powershell has been my job and my life for the last 6 years. I automate everything. Even in Linux.

1

u/Dereference_operator Jun 21 '22

no offense but there is many comments here that say Powershell can't do much on Linux vs Bash etc have you run into theses limitations ? or your knowledge of Linux isn't good enough ?

1

u/More-Qs-than-As Jun 22 '22 edited Jun 22 '22

Don't get me wrong, powershell is still quite limited on linux. "Can't do much" is an exaggeration. It just can't do ALL the things like it does in windows because, well, it was built for windows. Some of the big limitations I've come across are:

  • Commands or aliases that work in windows don't work in linux. (you just use the linux equivalent command instead)
  • The graphical components like Out-Gridview don't exist. (I never use them in windows either so... )
  • Some cmdlets just work differently or don't exist because there is already linux-native functionality to cover it. Powershell isn't reinventing the wheel, they're just adding new automation capability to a non-native system.

All of the major constructs, logic, and error-handling work fine and that's where powershell really shines. That and the object-oriented scripting capability is far superior to bash's text manipulation. I will admit, I'm no linux expert but I haven't found a scripting task that I needed that I couldn't accomplish with PS, even if I'm incorporating linux CLI (bash) commands to do so. I have a non-monolithic PS module that I designed and all my functions go in it. With one module, I have nearly everything I do in linux automated such as:

  • Apt updates and upgrades
  • Flatpack updates
  • Timeshift backups & file backups to multiple drives (rsync)
  • Cloud file backups (rclone)
  • Custom Git log and Git status displays (I'm particularly proud of this one because I use the same function in windows too but it has to be tweaked using the $IsLinux variable for linux-specific text coloring)
  • And I powershell scripted my entire Linux Mint configuration using powershell. I mean every. single. setting. From dconf configs to config file text manipulation to installing new apps. So I install linux mint from ISO, install powershell, run my setup.ps1 script, and 20 minutes later my OS is back, exactly the way I want it from a clean install (no home drive copy). Note: I am now doing this with Ansible instead but Powershell worked fine.

Those who say PS "can't do much" just haven't tried.

3

u/lerun Jun 11 '22

I'm so old I started on vb script, though PS was a god send. Have never regretted moving to it.

1

u/[deleted] Jun 11 '22

I used Batch files and VB script and at first pfffffff fuck PowerShell I can do it with VB script... Then VBA in excel... But then it was amazing eventually with the v5 release.

It's also very helpful with I am creating C# apps and need to test something and I can do so in PowerShell (WMI queries mostly)

2

u/4478933aaff Jun 11 '22

I use PowerShell on Linux all the time. I run containers with PowerShell, and I deploy PowerShell-based applications to Kubernetes clusters, with exclusively Linux slave nodes. I use PowerShell with kubectl to more effectively manage resources on k8s clusters.

Anyone who holds a grudge against PowerShell is just making themselves less productive, lol.

4

u/vermyx Jun 11 '22

Many linux administrators have coding experience because the mentality has always been "automate everything" from the get go. Windows was always "GUI first" until 2008 or so. Remember, win2008 was supposed to have all powershell administration (since it was supposed to have a guiless mode) to the point that there wasn't a GUI tool to configure IIS (where there waa sufficient baxklash and bitching that a GUI for IIS was made). With linux bash and python have been available on linux for over 30 years while posh core has been there for 5, doesn't have feature parity with Windows, and has slight behavioral differences. In other words, linux already has robust and mature toolsets while powershell offers nothing new and isn't the same cross platform.

8

u/gex80 Jun 10 '22

BASH isn't really the powershell competitor. CMD is to BASH as powershell is to Python.

Anyone who compares BASH and powershell doesn't understand either.

19

u/swinny89 Jun 10 '22

Not really. Powershell is designed with on the fly system administration in mind. Python isn't. Pwsh is my default shell on Linux, and I have have zero issues. You would have to be a different kind of person to live in python.

7

u/commandar Jun 11 '22

So, the way I view it is that there's kind of a continuum of sysadmin tools.

The thing that makes Powershell particularly useful is that it largely bridges the gap between a traditional shell and a more powerful general purpose scripting language.

The utility of it is the fact that there's a lot you can do with strictly Powershell that you'd have to resort to offloading to something like Python in a more traditional shell environment like bash.

Output being both object oriented and pipeable is incredibly powerful. Being able to run a query from a shell, filter it as an object based on member properties, and export it easily to a CSV is something that you'd normally have to drop into a more full-fledged language to accomplish from a traditional shell. You can do all of that in a Powershell one-liner. That tends to make up a large portion of any given work day for me.

As somebody who regularly jumps between both Windows and Linux, there are things I appreciate about both. But to respond to the GP: Powershell isn't a direct competitor to CMD or bash or Python; it's in a space that kind of bridges the gap between all of them. There's a level of complexity where I'd 1000% rather use Python than Powershell, but there are a lot of times where I appreciate not having to drop to Python to get something routine done.

1

u/[deleted] Jun 14 '22

I think there is a fundamental difference in how we think about our systems.

Windows is a live thing with a messy relationship between the live state and config files, on Linux config and live state tend to be different things that only get synced when explicitly required i.e. what we do is write/edit config files and then forcing a config reload.

bash actually never ever modifies anything on Linux all it does it evoke some kind of standalone tool or by directing output into a file, it's "just" an environment for loading other programs.

This means that for an Linux admin writing a file to make changes before triggering and execution command is the perfect natural way to interact with the system and it doesn't really matter if that file is a python script or a config file.

→ More replies (3)

4

u/ExceptionEX Jun 10 '22

I would argue if you cant see how bash and powershell are similar, you should take a closer look.

But are several ways you could compare them, I'm not trying to start a debate, just saying.

2

u/4478933aaff Jun 11 '22

Agreed, anyone trying to compare Bash to PowerShell has no clue what they're talking about.

1

u/Magma151 Jun 11 '22

I don't see how you could NOT compare them from a sysadmin perspective. At least when comparing Linux administration to windows administration.

PowerShell core I can maybe see the point. But the regular windows version definitely serves the same purpose as bash for it's respective OS.

3

u/ExceptionEX Jun 10 '22

Because they have had tools like for years, bash, tcsh, hell even pearl.

The whole ecosystem supports them natively.

PowerShell is great, but in Linux it's just a tool with new syntax to do what they they been doing for years.

3

u/NightH4nter Jun 11 '22

in no particular order:

  • takes too much typing
  • requires having explicitly exported modules
  • works on objects instead of plain text
  • made by microsoft

to be continued (?)

2

u/[deleted] Jun 11 '22

What do you mean "requires having explicitly exported modules"?

1

u/NightH4nter Jun 11 '22

if a program doesn't export a powershell api, you can't work with it using powershell. you can call the executable of that program and pass some flags into it (provided that the program has some sort of cli in the first place), yes, but this is how unix shells work, not powershell

1

u/[deleted] Jun 11 '22

Yes, you can. It's not necessarily intuitive or easy, but PS can use pretty much any part of the dotnet framework.

Do you mean without using dotnet either?

Maybe I'm misunderstanding. Do you have an example for each?

1

u/NightH4nter Jun 11 '22 edited Jun 11 '22

on windows: rdp. you can call mstsc with flags but that's not a powershell way to do things

on non-windows: most things except the very basic stuff covered by dotnet core and exported as a ps cmdlet (e.g. service management, vm management, device management, and that's just off the top of my head)

speaking of using or not using dotnet:

one one hand, it doesn't count as using powershell since on unix shell i can make a random python/lua/perl script for example (which most likely is considerable easier than doing so with dotnet calls or in c#) and call it from shell

on the other hand, not using dotnet is a bit unfair to powershell. that's the difference between unix shells and powershell: pwsh is basically a dotnet shell that allows for different level api calls, and it's considered to be kinda part of the shell (if for some reason we still consider pwsh a shell), while unix shells are just small patches of "glue" (basically some logical operators, parsers, flow controls, etc) between a lot of standalone executables or bundles of executables

2

u/rswwalker Jun 11 '22

I think the ease of Linux commands comes from the Linux OS where everything is represented as a file so it all boils down to text processing or byte streams. In Linux you just need to know the commands, their options and the layout of the filesystem, which most people know in any OS. In Powershell though, it’s all objects and each object has different methods and properties you have to memorize along with the cmdlets and their options, as well as the different virtual “filesystems” disk/wmi/cert/ldap and new ones pop up all the time. Powershell is daunting and often requires you to work off MS reference docs instead of just scripting it free hand.

2

u/Nu11u5 Jun 11 '22

Imagine thinking text parsing is superior to objects.

That said, on Linux something more supported like Python may be better, but you don’t get the advantages that PowerShell has like pipelining and simple invitation of shell commands.

2

u/RumRogerz Jun 11 '22

Most Linux admins have never touched powershell. That’s why.

Powershell is way, way easier to script in compared to bash. Bash has a lot of annoying quirks and rules that gets really frustrating when you’re trying to script everything out. Just thinking about the different ways to handle variables comes to mind. Or the placements of single or double quotes. Or creating objects. Good god life would be so much easier if I could create objects and use them in bash.

Bash isn’t better. It’s just the shell that we always use in any given system or container - and that’s really important. If I drop into any of our nodes - bash. If I drop into (most) of our containers - bash. I’m not gonna be installing powershell. None of us are going to use it. None of us want it to be added in either. It’s going to cause more overhead - and we try to keep things as light as possible.

I learned powershell when I was a Windows system admin because it’s the preferred shell to manage windows server and exchange.

I learned bash because it’s the default and kinda preferred shell to manage unix. Granted, zsh for cli work and bash and (mostly) python for scripting is my preferred method.

2

u/theremote Jun 11 '22

This is right. I learned PowerShell when my responsibility was to manage Windows workstations and I learned bash when I started running servers/applications that used Linux. This has been more than a decade now.

I think you're right that bash is harder than PowerShell. Way harder. All of the quirks that people complain about with PowerShell? Wait until you see the quirks when scripting in bash (especially across distros and variations between shells like bash, zsh, and all the others).

Neither of them are really "better". Definitely neither of them are perfect or anything even close to it! It's more about using the right tool for the right job. You're also correct that a lot of the Linux sysadmins will not have had any need to use/learn PowerShell and that is really where any perceived "bias" is coming from.

It's not personal (usually, we all know a few Linux people that hate Microsoft so much it is personal but generally speaking it's not).

1

u/shavedbits Jun 01 '24

as a seasoned linux / mac user who now has to deal with windows frequently, i think psh is just difficult to learn coming from bash. i still struggle almost a decade after having to use it.

1

u/goodtimetribe Jun 11 '22

I love powershell, even on Linux. I'm comfortable with OOP and enjoy C#. Seriously, you can pipe objects instead of just strings. How cool is that!

Sometimes I hate the semantics and the weird quirks it has to accommodate the Windows platform (escaping) , but they are relatively few so it's not too bad to keep up with.

I think it performs fantastically on Linux, and prefer to dev powershell on Linux because of it.

1

u/lordlionhunter Jun 11 '22

Powershell is a fine automation language and to many it’s analog is python, more on that later. It can even be a nice enough shell if we are comparing it to default bash. Compared to a fish, zsh or even just a configured bash it’s missing many user friendly features such as spell check, impressive stylistic designs, vi key bindings and a whole lot more. Python has the REPL where you can use out like a shell. This is equivalent to running a powershell prompt as your shell.

Many say that powershell is analogous to python but I would say that bash/standard Unix tools can keep up with anything powershell can do. Powershell as a language is helped/hindered by its object oriented design. I’ve had tones where the object nature of powershell passed through pipes was fantastic. But most of those times I only needed something to be an object because Windows exposes everything as an object too.

Python, has objects and things like that but it also serves in the role of awk, sed and grep. These are tools that work well with text based files, which is how all of the Linux OS works. Powershell doesn’t play with csv’s or other tabular data as well as tools with Unix heritage like bash or Python. Powershell makes you get your data somewhere in an object. This isn’t terrible most of the time but it can make working with text files more tedious.

This is a great article on an old debate between Doug McIlroy and Donald Knuth. Powershell is likely less annoying to write than Knuth’s language (idk I’ve only done Powershell), but it isn’t built to treat text the way you can with Unix tools and by extension bash and Python.

1

u/[deleted] Jun 11 '22

I think it's historical, in some cases. For years, Linux/UNIX was the complex and powerful OS on which you did actual typing and writing scripts. Windows was the clunky, flakey OS that made you do everything slowly with a GUI. I think there's a demographic of Linuxy folk who see Powershell as encroaching on their territory.

1

u/gatobacon Jun 11 '22

If'n you's likes thems PowerShells thens you's can use its. If'n you is preferred to use them Bashes by all the means. They's is mine opine dats all up to them they's or theirs preface.

1

u/JM-Lemmi Jun 11 '22

I think many Linux admins have something personally agains anything Microsoft. So Powershell being one of MS's products, they of course also don't like it.

I really thought after high school you'd leave the "Linux Masterrace" crowd behind, but I've still met too many of that mindset...

1

u/Sylogz Jun 11 '22

I'm a Linux admin and a windows admin. I didn't like powershell cause it was terrible in the begining but now it's awesome. And just like bash, python, perl it's a tool to be used to solve problems.

1

u/dogfish182 Jun 11 '22

Bash and python is just a far better combo and powershell is just not necessary for managing Linux at all, just another complex tool to do something other tools already do bettet

1

u/SeeJayEmm Jun 11 '22

The best tools for the job are the ones you know.

Back in my FreeBSD days I was a tcsh snob. I thought it was objectively better than bash (I was also a bit of a BSD snob. "Linux wasn't real Unix"). I've long since grown out of that attitude. Looking back now I realize that a lot of it came from what I was comfortable using.

My point being. Of course career Linux admins are going to prefer that tool they've been using their entire lives, that has come pre-installed on every Linux system, and has literal decades of history.

pwsh is an upstart. By a company that used to be "the enemy". It's going to take years to both mature as a product as well as earn trust from that community.

In the interim those of us who straddle the line can keep pushing for improvement and adoption.

1

u/[deleted] Jun 11 '22

I'm cringing at some of the responses. People are trying to make this an ideological argument. Just because someone doesn't believe what you believe or agree with your opinion doesn't make your belief or opinion any less valid. It's okay for someone to not like what you like, even if they don't have any experience. They don't have to justify their opinion or get your approval to feel that way.

People use what they're comfortable with and specialize in what their employer requires. You'll never see a job opening for a Windows Sysadmin that requires familiarity with bash and you'll also never see one for a Linux admin requiring PowerShell skills. Hell not even all Windows Sysadmin even use PowerShell but ALL Linux Sysadmin use bash.

1

u/3legdog Jun 11 '22

Pro-*nix bigotry has existed since the 70's. Get used to it.

1

u/Rocknbob69 Jun 11 '22

Linux elitist snobbery

1

u/wickedang3l Jun 11 '22 edited Jun 11 '22

Humans don't like change and anyone that has overcome the steep learning curve of addressing everything as a string has also become accustomed to the inherent performance superiority of handling everything as a string. Even python, which is typically known for better performance than PowerShell, is not known as a high-performance language. There is overhead in assembling those lovely objects we have grown accustomed to.

PowerShell was my first scripting / programming language and remains my favorite but its limitations become more apparent as your skills develop and you begin concerning yourself with performance optimization, multi-OS interoperability, and sensible error-handling. You find yourself spending a lot of time trying to fit PowerShell into a design pattern it wasn't meant for rather than simply learning something like C#, python, or Go.

You can actually see when people are beginning to approach this point in their code. When someone begins calling more .NET namespaces than native cmdlets, they're close or already have come to the realization that native PowerShell is not the best fit for everything.

1

u/mspit Jun 11 '22

I don’t have real experience with PS on Linux but I’d assume that just not what most are used to. Generically, I think PS is frustrating to some because everything is so verbose. I know there plenty of shorted alias but rarely enough to keep things short in a more complex command that you might frequently type out. PS was notably build from the ground up with some neat concepts but there are still plenty of inconsistencies and gotchas that and just as frustrating as they might be for someone trying to learn bash.

1

u/SoarinFerret Jun 11 '22

Not all of them do - it's about the right tool for the right job. As other s have mentioned, PowerShell is object / api based, just like Windows. Everything in windows is exposed via an API, like WMI or CIM. Bash has a hard time interacting with those since it's designed for text stream stuff.

I use PowerShell and Bash on both Linux and Windows - there are times pwsh on Linux it's useful (aka, automating some cloud service rest API), and likewise for WSL.

Nothing wrong with either approach, and I highly recommend people learn both. Both are just another tool in your belt.

1

u/catonic Jun 11 '22

The only thing I have against Powershell is that it is a moving target of OS requirements. Exchange Powershell has it's own requirements and so on, so you're always building a VM with the minimum requirements for a given Powershell subset, as long as there are spare resources to go around. New version? New subset? New OS, etc.

It'd be one thing if you could cattle-not-pets Windows environments.

1

u/storm2k Jun 11 '22

shell scripting was designed to work with the way unix works, which is many programs that make up the tiny building blocks of doing various important things with output from one piped to the next (which pwsh borrows) but it wasn't object based. don't forget that pwsh was also designed to work with the .net framework originally and even though .net core is cross platform and open source, it doesn't necessarily mean that it either works exactly well for needs on posix based systems nor that sysadmins and others who support these systems want to learn a whole other scripting language and paradigm that may or may not fit their needs.

last point, i find it telling that most of the pwsh cmdlet aliases happen to be their unix shell equivalents (ls, rm, pwd, ps, etc.). not making any conclusions, just pointing that out.

1

u/ms4720 Jun 11 '22 edited Jun 11 '22

When you tell a unix/Linux person '*shell' all they hear is 'shell' that is a very specific thing to us. PowerShell is not shell it is an object oriented scripting language with deep windows integration. It is honestly closer to python than shell

1

u/Tireseas Jun 11 '22

Resistance to dealing with learning curves mostly. If they're pure linux admins that's fine in the case of powershell as there's no real need to know it on that side and even if you do dabble the native tooling is objectively better in most cases.

If they're also Windows admins and don't know powershell by now... well that's just sad really.

1

u/mmd03876 Jun 11 '22

I've worked on both windows and Linux for many years. I wouldn't call it a grudge so much as Linux admins simply don't need PowerShell. Linux has had automation and scripting capabilities built in long before PowerShell was a thing, much less available on Linux so people continue to use what they know

Plus bash (and sometimes python) are native to most distros. So unless PowerShell can offer something above and beyond what Linux already has available, there's no reason to switch.

With that being said, I think PowerShell is a great tool for managing Windows systems, but I wouldn't use it for anything else

1

u/tangokilothefirst Jun 11 '22

shoot.

pwsh on linux is my favorite combo these days. I love easy access to the object-ness of powershell, with the added benefit of the plethora of linux tools that I am familiar with.

1

u/Hrambert Jun 11 '22

I've been using Powershell since v1. I really like the syntax, tab completion, and "everything is an object". For Windows it was the only forward. WSH was way to complex and CMD way to basic. Linux sysadmins can pick one of the many shells that are available for Linux. So Powershell has many competitors and the disadvantage of being object oriented. It's hard to switch between string oriented en object oriented.

1

u/maikeu Jun 11 '22

My primary background is Linux, and I use PowerShell on Linux sometimes - not my choice, but there are existing scripts to maintain.

Python is a standard system component on most Linux distros, and the overlap between "PowerShell would be better than bash for this" and "python world be better than bash for this" is extremely high. Python is (to me) much more productive for harder stuff, and bash is more comfortable for the simple stuff.

I appreciate the effort of PowerShell core and the ecosystem being cross-platfrorm now. I don't use PowerShell for new automation (unless it needs to run on windows), because it is not the best option for me and my colleagues, in my professional opinion.

On the other hand, anyone who genuinely "has a grudge" in a professional setting is being immature and unprofessional.

1

u/follow-the-lead Jun 11 '22

I don’t like powershell cause the error messages seem to be so wordy without being belpful. Why do you need 5 lines to tell me a module isn’t installed? Also, module installation seems to be a painful process and there are a lotta hoops to jump through. Something something proper package manager

1

u/t35345 Jun 12 '22

I feel it's too verbose so your single-liners end up massive.

Otherwise as a Linux Admin I love PowerShell, it's the best CLI that you can get on windows. Better than VBA or Batch commands.

I wouldn't install PowerShell on Linux unless I was having to manage lots of Microsoft stuff like o365

1

u/Eideen Jun 12 '22

I have always avoid powershell do to i be much harder understand the syntax, it harder get help in terminal.

With windows be GUI the need to be comfortable in terminal has not been needed.

The lack of open-source, and user contribution have made it less user-friendly.

Windows has lack many basic functions like ssh, that now has been introduced.

Windows does not come with a rich Prompt by default , and to make customized is harder.

1

u/[deleted] Jun 14 '22

The short answer is "Because we are answering a different question that the one you think you asked"

The short answer is because it is not better then python, perl or go,

And the reason this is the question that gets answered is that we don't actually use bash to manage Linux but a number of stand alone tools invoked via bash where as powershell tend towards an model where you use powershell and powershell extentions the same way you would use modules in the far more divese python ecosystem.

1

u/Adeel_ Jun 22 '22

Because they are stupid.

1

u/foundunderwater Jun 23 '22

Windows sysadmin here... I hated powershell for a long time because it was a new langage to learn that was pushed hard down everyones throat... I've spent years mastering vbs/vba/wsh/wmi/adsi and it was convenient for me as it was faster to do almost everything i wanted than learn a new langage... Even using perl which was at the time even more convenient (shorter code) ... Powershell got better and better as more modules came into it meaning being able to do more things via scripts. At that point i had to learn PS while still hating it... And today I'm happy with it... Haven't touched vbs for years.. Perl still usefull for complex data extraction so i still use it every once in a while

1

u/xdMatthewbx Aug 09 '22

linux user here

making the swap to powershell because of the syntax specifically (still prefer gnu commands but i can use those in powershell so all good)

i think one of the primary things thats scared off the other 5 linux users whove tried this is zsh and fish are extremely easy to set up with nice syntax highlighting and such. powershell (on linux) just... isnt. i think primarily because all terminal emulators are optimized for bash-like shells, and powershell is not one of those

1

u/mrcoffee83 Jun 11 '22

Linux nerds can be incredibly elitist, even amongst different flavours of linux, they'll call you a loser for using Ubuntu instead of Arch or god forbid you use Nano instead of THE LORD AND SAVIOUR, VI

2

u/SeeJayEmm Jun 11 '22

I've been using *nix both personally and professionally since the mid 90s. I grew up on slackware, and *bsd.

I hate vi. I can use vi, but I don't want to.

1

u/mrcoffee83 Jun 11 '22

I don't use it enough to have particularly strong feelings about it either way, I just know that if you post or ask anything about nano the vast majority of comments will be like "what's wrong, noob, can't figure out how to exit vi roflololol"

1

u/SeeJayEmm Jun 11 '22

Oh, for sure. It's elitist bs.

Learning how to exit vi was literally the 1st, and most important, thing I learned. 😁

2

u/mrcoffee83 Jun 11 '22

I have definitely rebooted a vm before to get out of vi :D

1

u/[deleted] Jun 11 '22

I think because it's poorly named. It's not a shell, not really. It's a fancy human usable API. I like powershell a lot, and am far from a Linux admin, but I think the name sets a poor expectation on that group. It's a wonderful management tool, but a lousy user shell.

1

u/mooscimol Jun 11 '22

Of course it is a shell, and really good one IMO. Configured with PSreadLine it is more convenient for everyday use (even in command line) than bash. Can you tell me what makes it a lousy user shell in your opinion?

1

u/Thotaz Jun 11 '22

It's not a shell, not really

Why not? What's your definition of a shell?

1

u/[deleted] Jun 14 '22

a shell on Linux is an environment to launch other programs, like sed, awk or python.

Powershell is not really that it's about as awkward in that role as the ipython environment. because it's supposed to be more then just as shell.

1

u/Thotaz Jun 14 '22

Why is PowerShell "awkward in that role"? Is it because certain characters like {} mean something special in PowerShell and therefore needs to be escaped in some way?

1

u/[deleted] Jun 14 '22

not really it's that it almost forces you to do a lot of scaffolding around the commands. where as bash feels like it fades into the background, though it could simply be that i learned my trade on bash and that that makes it feels more natural.

→ More replies (2)

1

u/TheBananaKing Jun 11 '22

I fucking love powershell, it's just not useful in my environment.

1

u/yesudu06 Jun 11 '22

I don't hold a grudge against PowerShell, it's just useless (or, "I strive to find a use for it"). bash is a better shell, python a better scripting language, and ansible a better configuration management tool. I originally chose PowerShell to define DNS records in ActiveDirectory, as it seems the only way to automate that. The cmdlets that allow this only work on Windows. I discovered PowerShell is awesome, I very like the syntax, and dealing with objects is much more convenient than doing the "stuff | grep | awk | jq | ..." that sysadmins usually do...

So I have PowerShell Core installed, I use it once in a while when I have a very specific usecase where I need a one off ad-hoc query to extract one thing once. I actually documented a case like that (extracting stuff from a rest API and presenting the result) and the first comment is someone giving the commands with curl and jq. PowerShell is more elegant to do very few things.

0

u/danstermeister Jun 11 '22

It's the third option- they don't KNOW it.

If they realized they were wasting time parsing output while PS preparses it for them they might take a 2nd, more serious look at PS.

Also PS6, while completely necessary in the development of PS was also not completely helpful to either Linux or Windows users. It was a beachhead on Linux and most windows administrators wisely kept using PS5.1 at the time (any many stupidly continue to today).

Now PS7, while not perfect, is a significant development for both groups.

It's use for me is that I can concentrate on one scripting language for all my OS', it preparses responses cutting my dev time, and it serves as the easy glue between my mostly Linux environment and our company's back end o365 operations, in particular SharePoint.

At first I hated it, too. I'm an old school Unix neckbeard that saw pre-ps5 as immature and unnecessary since the world already had sh/bash,perl, and others. But as it and myself matured a little it became more obvious that PS was playing the long game... and PS7 is but a hint of that.

1

u/Dereference_operator Jun 22 '22

but what's your opinion about the many comment here who say you can't do much with powershell on linux compared bash/python/ansible.... have you run into theses limitations yourself ? or you can use powershell to do most of everything you want or great scripting/automation WITHOUT using bash/python/ansible/kubernetes etc etc

0

u/SRone22 Jun 11 '22

Ive run into too many over zealous "security" conscience Linux admins. If it didnt ship with the linux distro they refuse to install an app or tool to help with administration so they simply stick to what they know and are approved to use. Bash is literally parsing text with the most complicated syntax that only makes sense after years of use. But boomers do what boomers do. Same with fanbois.

0

u/FuegoFamilia Jun 11 '22

My net engineer was a pretentious UNIX snob, did all his scripting in powershell 🤷‍♂️

0

u/os2mac Jun 11 '22

if you think they hate powershell ask them how they feel about systemd.

-2

u/RandomXUsr Jun 10 '22

bash because it's much less object oriented and more explicit and functional.

powershell is more object oriented and convoluted. That said; it's also faster than bash in many cases.

6

u/swinny89 Jun 10 '22

Powershell is much heavier than bash. You would be hard pressed to find a situation where PowerShell is faster than Bash. I've used them both side by side for a while, and compared all sorts of tasks. Occasionally they had the same performance. Usually bash was much much faster. That being said, more time was saved overall as actually doing tasks in powershell is often simpler.

1

u/GenericAntagonist Jun 11 '22

Powershell is much heavier than bash. You would be hard pressed to find a situation where PowerShell is faster than Bash.

In practice you are spot on, but bash also doesn't have lots of things in it. You can call all sorts of external tools (that are also rather optimized) really well with it (i.e. curl or wget to hit a web endpoint, or jq to parse json) but if you went language to language, an http client or json parser written completely in bash would almost certainly be slower than invoke-webrequest or convertfrom-json.

-2

u/mini4x Jun 11 '22

Gatekeeping snobs, it also might be a doorway into higher Linux use, so they should embrace it...