3
zymk
4y

I know a lot of people aren't fans of Microsoft here, but does anyone have some extended experience with using powershell?

I've been using it for creating a script that handles quite a large set of tasks for setting up and configuring some application servers and so far I have been really digging the language. Being able to invoke the script against remote hosts in parallel like ansible has been a really cool learning experience.

Admittedly it's verbose as fuck, so getting the same thing done in something like python/perl might be like half the lines of code. And I know that some of the commands illicit a "WTF?" every now and again. But I think one of the powershell tutorials I watched early on in attempting this helped make using powershell not suck ass.

Every command is basically 'verb-noun'. You don't know what the command or switches are:
> get-help "command" -showwindow

It will give you a list of options if you didn't select the exact command with get-help.

It feels* amazingly buttoned up as a scripting language and it's really cool to be able to take advantage of lower level stuff, like you can run alternative shells (we have cygwin installed on some of our servers), you can run C# code, you have access to interfacing with .NET api's. I haven't messed with anything azure yet, but being able to interface with products and services like SQL/Exchange/O365/azure/servers/desktops from the same language seems pretty cool.

Admittedly, the learning curve feels terrible though. I felt like a dunce for the first couple weeks, couldn't navigate the language at all, and was always in the docs trying to figure stuff out. I think I just needed to understand how the people developing powershell intended for it to be used. Once I was able to put two-and-two together about the verb-noun structure and how to find information/examples about the cmdlets it's been quite easy to work with it.

If anyone else has any extended experience with it, please share your thoughts/opinions. Curious to see if your experiences are/were similar to mine.

If you don't have Powershell experience, please feel free to share your opinions of Micro$haft and me for using Micro$haft products too! It's all good 😎

Comments
  • 1
    I've helped create an entire product that used powershell. I'm in agreement that it's extremely powerful, but a bit unapproachable. I believe there is intellisense available through some tool now.
  • 0
    @monkeyboy That's freaking sweet! What does the product you developed do? (Just in case you didn't want to name-drop the product itself)
  • 2
    Lots of people on devrant like to shit on MS products(myself included) but I absolutely guarantee there are people here who are versed in powershell.
  • 2
    *slowly raises hand*
  • 2
    When I first "met" powerShell I was coming from a *nix background so felt really awkward but once I got the ropes of it I started appreciating it.

    As my name implies I spend most of my time there and even use to automate the weirdest tasks in our environment (strong Azure/O365/MS shop) and to hook it up with obscure technologies building up automation "frameworks".

    All in all I think we're pushing PowerShell past the limits of its design but as you said it's pretty neat to be able to use lower level stuff and leverage native .Net frameowrk functions.

    As per the learning curve I think main issue, apart from some of its peculiarities, with it is a lot of admins/engineers need to switch their paradigm and start using paradigms which are "native" to devs but not to infrastructure people... which you can fully appreciate when checking SE's code :)

    TLTR: I agree with your thoughts :)
  • 1
    I often have to work with Windows servers at my job, and PowerShell makes it way less painful to do so. While I still prefer Linux shell scripting, PowerShell is still pretty good. Mostly I use it as a shortcut for things I would normally get from some kind of GUI. Back when I did tech support, it was a godsend for Active Directory queries and running commands on remote systems.
  • 0
    @jespersh would you call this a disappointment https://youtu.be/I14b-C67EXY
  • 0
    I stopped reading at powershell because i dont want to ruin my christmas with sympathetic feelings towards a developer facing issues with ... You know what OS.

    Sorry mate you have to suck it up
  • 0
    I can't grasp Powershell, mainly as I grew up with BATCH.
Add Comment