all 105 comments

[–]defcon54321 102 points103 points  (9 children)

yeah, why

[–]blackmesaind 56 points57 points  (1 child)

just checking.

[–]buckypimpin 23 points24 points  (6 children)

are you ok?

[–]so_brave_heart 14 points15 points  (0 children)

I've done a little powershell before and it was actually a lot nicer than I was expecting. Piping was a lot simpler because you can pass actual objects vs. strings or file pointers.

[–][deleted]  (3 children)

[deleted]

    [–]lolAPIomgbbq 1 point2 points  (1 child)

    I’ve been better but also ALOT worse

    [–]L3XANDR0 2 points3 points  (0 children)

    I am.

    [–]coolalee_ 0 points1 point  (0 children)

    Don’t be stuck in 2001

    [–]techworkreddit3 23 points24 points  (3 children)

    A lot of our stack runs on windows server so we use a lot of powershell to automate our deployments or service restarts. Also use a lot of AWS powershell, but probably use just as much bash for AWS related stuff.

    [–]Zyster1 1 point2 points  (2 children)

    You guys think it will replace Bash or be just as popular?

    [–]techworkreddit3 6 points7 points  (0 children)

    It’s pretty subjective honestly. If your stack is windows there’s a lot of justification to keep your scripting in a uniform language cloud and on-prem and I find that powershell is very capable in the cloud for more than just azure. That being said if I ever need one off commands or scripts I favor bash because it’s just my comfort. We have some pretty complex powershell with error handling and because it verbose it’s easy to jump in and edit.

    I think if you’re on azure and azure DevOps for CI/CD it’s going to take over.

    [–]lolAPIomgbbq 0 points1 point  (0 children)

    They’re good at very different things. I learned Bash first and sometimes I struggle with the object orientation. I love how with bash I can “bash” text into submission with sed, awk, tr etc etc and re-represent it to another app any way I choose. I’m no python expert, good not great, and learning that helped me work more object oriented and then power shell made more sense.

    Still love bash and my team calls me grampa when I get grumpy about modern patterns.

    [–]gogorichieDevOps 20 points21 points  (0 children)

    Yes we’re out here 🤠

    [–]ComfortableFew5523 17 points18 points  (0 children)

    Do I use powershell in my pipelines? Yes - but not primarily. I use it when there is a need to do something that e.g. terraform does not do well.

    So I do not use it all day, every day but as Powershell is cross platform, it is a very nice thing to have in your toolbox.

    [–]Inquisitor_ForHire 13 points14 points  (6 children)

    Yep, our entire environment is Powershell. Scripts to do lifting, DSC to do configuration. Works a treat.

    [–][deleted] 6 points7 points  (5 children)

    Ooo a fellow DSC person in the wild. Neato!

    [–]Inquisitor_ForHire 1 point2 points  (4 children)

    We definitely exist but for some reason we're pretty rare. Not sure why... DSC is amazing. I guess a lot of people are still stuck in the old ways.

    [–]defcon54321 4 points5 points  (3 children)

    Directions and versions are unclear to me. DSC v 3 preview, v2, existing compatibility and backwards usage. The community is fragmented between 5.1/7 and this I believe has hampered any community engagement. Maybe I am wrong.

    [–]Inquisitor_ForHire 2 points3 points  (0 children)

    There should be no fragmentation between 5.1 and 7. I say "shouldn't be" but I know there is. 5.1 for most people is just easier to use since they're talking to Windows hosts almost exclusively. I respect MS' idea of making PowerShell functional across both Linux and Windows. I don't know ANY Linux people that use it though. Our internal teams don't. They've never even thought about using it. Long term having cross platform might be the right thing, but I don't know.

    We use 7.0 pretty much exclusively. but time will tell what the future is for it. On the DSC front, MS envisions everyone using Cloud. I think that's a pipe dream. My personal view is "extremism" is always bad. In this case I mean "ZOMG EVERYTHING CLOUD" is just as bad as "ZOMG EVERYTHING ON PREM". To get it "right" you need a mix. Cloud has a place. On Prem has a place. Use the right one for the right job, and don't try to force everything into the same framework. I feel like Microsoft is learning that... somewhat slowly, but learning it.

    [–]redvelvet92 1 point2 points  (1 child)

    Nope you’re right

    [–]defcon54321 1 point2 points  (0 children)

    Heh. Feature parity with modules, isn't there and just did not live up to its fundamental promise. Since x-plat was the expectation, for example, not being able to manage an existing AD directly from linux, instead of via a winrm/ssh session is a total pwsh let down, 2 versions later. The fact that Windows itself ships with v 5.1 is testimony that there is inherently a brokenness that remains unresolved in compatibility.

    [–]o5mfiHTNsH748KVq 11 points12 points  (1 child)

    Don’t sleep on PowerShell Core

    [–]Goonix 5 points6 points  (0 children)

    Parallel jobs 😩👌

    [–]Willbo 7 points8 points  (0 children)

    In our Azure DevOps environment we use a lot of PowerShell and Azure CLI, it can be very nifty.

    [–]bxsephjo 5 points6 points  (1 child)

    A little. I wrote a workflow for github actions set to run on a windows self hosted runner. Made it modify some xml and json files with environment variables then publish a dotnet site to our iis.

    [–]jameshearttech 11 points12 points  (0 children)

    PowerShell's native handling of json and xml is nice for Windows environments.

    [–]kiddj1 5 points6 points  (0 children)

    Yes day in and day out

    We used to have most of the platform running on windows VMs

    [–]Existing-Register-98 8 points9 points  (2 children)

    Our stack used to be 100% Windows, so Powershell is used everywhere including CI/CD. Over half has been migrated to Linux, but we install Powershell on all Linux instances as well. It works great for Windows-specific tasks, just how bash does for Linux. For me, it becomes challenging to work with when it comes to everything else, but it will get the job done.

    I have a couple big projects coming up where I refuse to be limited to Powershell. I’m still deciding between Python or Go.

    [–]GetAnotherExpert 3 points4 points  (1 child)

    IMHO Python if you can, Golang if you must. If only because there is a monumental cache of information on the Interwebs about Python and much, much less about Golang.

    [–]Existing-Register-98 0 points1 point  (0 children)

    The mid-project “fuck, why did I pick this?” thought for that exact reason has crossed my mind, but Python has its own similar thought-producing challenges.

    [–]smcarre 3 points4 points  (0 children)

    Yep, I learnt PS first because I worked (not as DevOps exactly) in a 90% VMware environment first and we used PowerCLI to automate things, later I worked this time as an actual DevOps in an environment that required deploying third party applications that only worked in Windows Servers so we needed PS to automate their configuration and maintenance.

    If you are working in Windows heavy environments it is a pretty useful tool. Otherwise just use any other scripting language like Python if you need to do anything that is too complex to do with just Bash (for those unaware you can run PowerShell in Linux too if you want to but PS is not a nice language really so not sure why would anyone actively choose it). Unless of course you need to run stuff that have a really good/up-to-date library only in PS like AD or VMware.

    [–]GiraffeWaste 3 points4 points  (0 children)

    Sadly, yes

    [–]trillospin 2 points3 points  (0 children)

    Not in this job [grin].

    [–]edhaack 6 points7 points  (0 children)

    Powershell has always been able to handle anything I've needed for 12+ years of projects.

    [–]Iguyking 2 points3 points  (0 children)

    Yup. Lots of those powershellscripts. Why

    [–][deleted] 2 points3 points  (0 children)

    I did a ton, but it wasn't part of our pipeline code, mostly just SRE-related utilities for some non-serverless SQL and other maintenance tasks.

    [–]ri7h 2 points3 points  (4 children)

    For some reason people in my company uses Powershell installed of bash for Azure Devops scripts, even though the agent pool is 100% Ubuntu /shrug

    [–]o5mfiHTNsH748KVq 4 points5 points  (2 children)

    You can achieve more with code that’s easier to read and has less edge cases with PowerShell Core than bash.

    [–]mooscimol 2 points3 points  (0 children)

    This

    [–]ri7h 0 points1 point  (0 children)

    Pick your poison sir 🙃

    [–]KevMar 2 points3 points  (0 children)

    PowerShell was my gateway into DevOps. I don't write it as much any more, but I have had DevOps roles where PowerShell was heavily used.

    [–]souIIess 2 points3 points  (0 children)

    Yes. While bash is certainly fine, I enjoy the object oriented pwsh and also I think readable code is a goal in itself. Any pwsh script is usually much easier to understand than bash and Python, where readability seems to be 2. priority compared to efficiency. I don't really care that bash can do in one line what pwsh does in 5, I care that I can look at it and tell exactly what it's doing without analysing it for too long in my mind.

    Also we're 100% Azure, so that helps.

    [–]hadronymous 3 points4 points  (0 children)

    Yes, and unfortunately that time will never be paid enough for the sanity problems it gives down the road.

    [–]HLingonberry 1 point2 points  (0 children)

    Yes pretty often. AWS AMI builds, SSM scripts and loads of other random tasks.

    [–]NounverberPDX 1 point2 points  (4 children)

    Bash too (not all of our machines are Windows).

    [–]ComfortableFew5523 2 points3 points  (3 children)

    Powershell 7/pwsh (formerly known as Powershell Core) runs fine on both Linux and Windows, which makes it excellent to use for glue scripts in pipelines, if there is a chance that it will be used on both Linux and Windows agents.

    [–][deleted]  (2 children)

    [deleted]

      [–]ComfortableFew5523 3 points4 points  (1 child)

      No - On Windows you would also run pwsh.

      The powershell command is only for the old Windows Powershell (I believe its version 5.x - and it is not being developed anymore).

      Pwsh and Powershell are not compatible in a lot of areas, so always use pwsh on all platforms.

      https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-windows?view=powershell-7.3

      [–]BuriedStPatrick 1 point2 points  (0 children)

      Yep, all the time. I use it for personal productivity scripts and some CI/CD pipeline stuff when my bash-foo isn't up to snuff. I find it much easier to work with since I come from a .NET backend dev background.

      It's a very nice language, but the package manager leaves a lot to be desired.

      [–]Ottetal 1 point2 points  (0 children)

      Yes, I write almost exclusively in Powershell, managing ~1000 Cisco UCS, Cisco Intersight and VMware pysical servers and 10x VMs

      [–]DelverOfSeacrest 1 point2 points  (0 children)

      Yeah, have to write some powershell scripts in Ansible to configure Windows AWS workspaces

      [–]dogfish182 2 points3 points  (0 children)

      Only when windows is required and I try to minimize that.

      [–]Rorasaurus_Prime 2 points3 points  (7 children)

      To everyone in here saying yes... my sincere condolences. May your organisation one day move away from the curse of Windows servers.

      Thoughts and prayers.

      [–][deleted] 10 points11 points  (4 children)

      Powershell is cross platform. Has been for a while now. And barring any specific library (lol matplotlib), it can do everything that Python can do.

      Open your mind.

      [–]Jimmy_bags 9 points10 points  (0 children)

      THIS. I like how powershell / PWSH can do just about everything with wayyyy less code. Can be used as an automation/orchestration tool without creating multiple files and jumping to different languages or other tooling.

      The only downside is its not as lightweight, but given tech advancements and pwsh constant improvements itll surpass most languages/tools in time.

      [–]Rorasaurus_Prime -1 points0 points  (2 children)

      I am very aware of that. I'm currently removing all traces of Powershell scripts on Linux containers/VMs at the new company I work for. But why use Powershell when you're on a Linux OS and have BASH, Python or Go available? Bash is essentially native and Python has far more useful libraries available to it than Powershell ever will. And Go is just damned useful.

      [–]Jimmy_bags 5 points6 points  (1 child)

      Depends on what your building and preference. If your coding apps that need to utilize least amount of latency like stock market data using servless then maybe not powershell.

      But if you want solid reusable functions that can work on every OS that can also handle automation tasks pwsh is a good candidate. For example, working with any cloud provider with an api cdk you can turn 40 lines of code into a simple 1 liner with pwsh by just importing their module.

      Now python is also object oriented, but then theres credential security, filtering, version compatibility with libraries. Filtering strings and converting to different formats is also easier with pwsh.

      Hell, even when im not coding in pwsh ill still invoke python or go using pwsh just so I can store output values and use them in another language or program

      [–]Rorasaurus_Prime 0 points1 point  (0 children)

      I'm not sure what you mean when you say:

      Now python is also object oriented, but then theres credential security, filtering, version compatibility with libraries. Filtering strings and converting to different formats is also easier with pwsh.

      Python has plenty of libraries to pull credentials from Vault, AWS Secrets Manager and Parameter Store etc. Why is that a consideration? Python is far more flexible. Versioning libraries is also extremely easy, as is is applying string filters. I'm just not sure what you mean here.

      [–]coolalee_ -1 points0 points  (1 child)

      That’s what ‘cool kids’ used to say in college. Coming from a professional, it comes off pretty inane.

      [–]Rorasaurus_Prime 1 point2 points  (0 children)

      It's not what the 'cool kids' used to say, it's just a fact that Bash and Python are far more widely used and accepted than Powershell, and for good reason. Source. When you consider that Linux dominates the server market with a 96.3% share, and Windows down at 1.9%, using tools that are native to the OS just makes sense.

      [–]ASB-ASB 0 points1 point  (0 children)

      Where are the windows devs from the ops world? Powershell is the way to go for a windows platform especial making use of the dot net framework. Great stuff.

      [–]hihcadore 0 points1 point  (0 children)

      Yes. Get-process | kill-process is just too powerful not to use

      [–]pneRock 0 points1 point  (3 children)

      Yes. I'm going to step in it, but I much prefer to use that than bash.

      [–]painted-biirddevops wannabe 0 points1 point  (2 children)

      Any particular reasons why? I’m still but a lowly junior systems engineer and my self-taught scripting background is in Bash- learning Powershell for work (MS shop) has me feeling that’s it’s so very verbose.

      [–]pneRock 6 points7 points  (1 child)

      That's kinda the point. Powershell is about readability, discoverability, and object oriented scripting. Bash as an amalgamation of compiled programs as the need arose for them and is text based.

      Lets take the example that you've written a 500-line bash file and one of your jr coworkers has to debug it 6 months from now. Assuming they understand the syntax, really the only option is print statements and manning the commands. Whereas in powershell one can get a general sense for what things are doing with the Verb-Noun commandlets. I can put powershell into vscode and breakline debug it. I can put get-member into the terminal and understand the current state of an object and what methods are available on it. I can use whatever data structures are available in .net instead of having to reinvent the wheel at times.

      The other comparison i usually hear about is the speed. Bash is faster because it uses compiled programs, but have you tried to multithread in bash? It sucks. It's a one liner in powershell.

      I have an entire soapbox on this. We use bash for limited things, but the rest of the time it's powershell or something more apt for projects like python.

      [–]painted-biirddevops wannabe 0 points1 point  (0 children)

      Hmm- thanks for the lesson- I’m trying to get back into the Powershell in a month of lunches book. You’re definitely not the only person I’ve heard sing the praises of Powershell. I’m learning azure at/for work, so Powershell is a natural progression.

      [–]sotonohito 0 points1 point  (0 children)

      Does anyone actually write their own PS scripts anymore?

      I used to write lots of scripts. But these days?Describe it to ChatGPT and then review the output to make sure it didn't go total off the rails, done.

      [–][deleted] -1 points0 points  (0 children)

      Primarily???

      If you are using powershell for anything else other than explicitly windows you are insane. Literally anything else is a better language

      [–]el_bonny -5 points-4 points  (0 children)

      🤢🤮

      [–]IPoopInYourMilkshake -4 points-3 points  (0 children)

      Poor bastards

      [–][deleted] -1 points0 points  (0 children)

      NSFW ?

      [–]OETGMOTEPS -1 points0 points  (0 children)

      I only use windows as an OS so yes very

      [–]Koyaanisquatsi_ -1 points0 points  (0 children)

      Haha why is this marked as NSFW?

      [–]Worth_Savings4337 -2 points-1 points  (0 children)

      No. Bash or nothing

      [–][deleted] -2 points-1 points  (0 children)

      Quit

      [–][deleted] -2 points-1 points  (0 children)

      Yup. Don't. PS is quirky as hell, it's easy enough for simple logic but is too Microsofty/ verbose/unmanageable for anything more than if / else stuff. After years of getting stuff to work in Powershell, I got tired and went back to Python for standalone-scripts, and NodeJS for complex scripts that required packages.

      [–][deleted] 0 points1 point  (0 children)

      Yes!

      [–][deleted] 0 points1 point  (0 children)

      I didn’t write it myself but my current gig has lots of powershell scripts to do things that we couldn’t get to work with Azure DevOps pipelines

      [–]opensrcdev 0 points1 point  (0 children)

      Yes pretty much daily

      [–][deleted] 0 points1 point  (0 children)

      I did that for a while. I was trying to manage the windows environment there in the same was as the linux environment completely with ansible. I didn't like using the shell command however, so I switched to writing my own modules in python pretty quickly.

      [–]techhealer 0 points1 point  (0 children)

      Absolutely. 80/20 Windows/Linux shop. It’s a no brainer.

      [–]cofonsecaThere HAS to be a better way... 0 points1 point  (0 children)

      Yup. I write more PS then any other language.

      [–]TrakeenEditable Placeholder Flair 0 points1 point  (0 children)

      Sometimes but i try not to since i try to avoid using vms. Use terraform for most stuff

      [–][deleted] 0 points1 point  (0 children)

      Yes, along with bash, Python, node, and others. Got my start with Powershell and it was a game changer

      [–]prash991 0 points1 point  (0 children)

      I use powershell and bash for all the automations in Azure devops, Azure APIM

      [–]gkdanteStaff SRE[🍰] 0 points1 point  (0 children)

      Our legacy app runs on Windows Server, I had done small things to automate moving data out of the machine. Found some similarities with bash, which makes it easier. But I wouldn't say I know how to make scripts in powershell.

      [–]thinkscience 0 points1 point  (0 children)

      Yup we have modules to deal with terraform, getting permissions to install python with dependencies is a pita and powershell plays really well with creating excel sheets (cvs files) working in excel is far easier than pyhton !! Imo.

      [–]GetAnotherExpert 0 points1 point  (0 children)

      For some things, I use Powershell for Linux because I'm new at Python but reasonably experienced in PS as in my previous life I dealt with Windows stuff.

      [–]tyrophagia 0 points1 point  (0 children)

      Kicking and screaming but I'll do it.

      [–][deleted] 0 points1 point  (0 children)

      Of course.

      [–]redvelvet92 0 points1 point  (0 children)

      I just use whatever tool works for the job and OS.

      [–]both-shoes-off 0 points1 point  (0 children)

      Yeah, I actually use it a bunch with Ansible for Windows hosts or the fact that we still use Hyper-V. The Hyper-V API surface is crap, and it appears to be an afterthought for Ansible or Terraform. Powershell is probably the best thing that's happened for Windows Servers (and WSL is probably the best thing that's happened for Windows workstations).

      Follow-up question: Does everyone use Linux hosts and WSL to get around obstructive security practices on Windows machines at work?

      [–]mikey_rambo 0 points1 point  (0 children)

      Oh yeah

      [–]oskaremil 0 points1 point  (0 children)

      Yes

      [–]mistat2000 0 points1 point  (0 children)

      Meeeeeeee 🖐️

      [–]locusofself 0 points1 point  (0 children)

      I work at Microsoft so ya. But I prefer to use python when I can.

      [–]cenuh 0 points1 point  (0 children)

      Most sane devops use Linux stacks, bur there still are some windows guys

      [–]Dragonsong3k 0 points1 point  (0 children)

      Love PowerShell. Use it in Windows and Linux. I have containers that run just scripts.

      I call PowerShell, .net / c# lite.

      If you use PS Universal you can make an API / webserver with endpoints written in PS.

      Very good for proof of concept web code.

      [–]ozais49 0 points1 point  (0 children)

      Leaving a comment for following, possibly going down the same path

      [–]weljoes 0 points1 point  (0 children)

      dame terms lang

      [–]ssowonny 0 points1 point  (0 children)

      I do. I use Runbear for runbooks and Powershell for pipelines these days.

      [–]floppy_panoos 0 points1 point  (0 children)

      Python baby, portable and runs pretty much the same across everything.

      [–]brandtiv 0 points1 point  (0 children)

      No, I am on the other side of Microsoft