thoughts on PowerShell

I’m enjoying learning powershell and the scope on what can be done, is amazing.
General question, do people believe powershell is easy to learn? Does The Verb Noun Syntax Make it straight forward?
What are peopkes thoughts ?

I found it far easier to learn than most scripting languages. Its less strict than vb or c++. And objects make the pipeline so much cleaner than batch or bash.
The verbosity of commands help a lot at 3am when something broke. and tab completion counters the verbosity while helping avoid carpal tunnel.
It also makes IT fun again. I can document a presses by saving my command history instead of a fifty page word document with screenshots.

Perception is a tricky thing. Asking for opinions can be dangerous. :slight_smile:

You may not get as diverse a response, being that this is a PowerShell devoted site. Objectively (as I can be) I think the Verb-Noun syntax, while a bit disconcerting in its verbosity to begin with, is actually one of the reasons it is easier to pick up. The initial meaning can be understood without programming knowledge.

For instance: Get-Item. You could ask your neighbor what they thought that might do, and they’d most likely be right. It gets an item. With verbosity comes clarity.

Probably one of the greatest things about PowerShell though is the use of objects. These, I think, are far easier to understand and manipulate than strings. Manipulating strings can be painful.

If I wanted to get the name of this process via string manipulation, for instance, I would have to do a bit of manual work. Maybe use regex or substring commands. Maybe you could get the length of the string and work backwards. Either way you go you have to think about it and then create your own “filter”:

PS C:\windows> Get-Process | Select -First 1

Handles  NPM(K)    PM(K)      WS(K) VM(M)   CPU(s)     Id  SI ProcessName
-------  ------    -----      ----- -----   ------     --  -- -----------
    324      23    24512      19644   221    32.95  24052   1 Agent

Or I could just say Get-Process | Select ProcessName -First 1
Or I could put it in a variable like: $MyProcess = Get-Process | Select -First 1
And then I could get the name by typing: $MyProcess.ProcessName

No extra logic necessary.

So yes, I think PowerShell is easy to learn, especially in comparison to other languages. Take a look at the difference between reading a csv in PowerShell and reading it in Python (another language that is considered easy-to-learn).

Python:

import csv
with open('some.csv', 'rb') as f:
    reader = csv.reader(f)
    for row in reader:
        print row

PowerShell:

Import-Csv "some.csv"

I think that’s pretty much the epitome of simplicity in a very good way.

I like PowerShell because it’s easy to learn and very powerful. PowerShell is being used by every vendor so it’s a must, must that admins learn PowerShell. It makes it very easy to get the job done

Thanks, for your thoughts. I read somewhere that it was an easier language to learn and everyone can do it, which took away the specialist skill. That was seen as a drawback.
I personally think it’s great and yes you can do some things easier, but there is something for the advanced person.

Reading Doug Finke’s blog or articles from the brilliant Bruce Payette, shows that digging deeper in PowerShell can get very advanced (and cool !).

Like with any new skill there is an uphill climb at the start. The experts will tell you how quick it is to do things in PowerShell as compared to its predecessors. That is true but starting out I found I took more time putting together a PowerShell script than if I tried doing the same script in DOS/vbScript. I had a few false starts where I looked at PowerShell but with 2003 DCs until last year I kept going back to vbscript.

After our DCs went to 2008, I resolved to use only PowerShell. After about 3 months (and having watched the MVA videos on PowerShell) the payoffs really started coming.

For example, this morning I wrote a script of about 8 lines which cut over the VPN settings for my entire domain by editing an XML file. This was a horrible proposition in vbscript or DOS where you had to parse, swap out the files, maybe even use Regular Expressions. It worked on my first run too.

Micmaher

I found that the initial breakthrough into PowerShell, where you can start writing simple scripts, was a lot easier than other programming or scripting languages.

This being due to the ‘intelligence’ of it, for example not needing to explicitly define or even create objects, and even passing parameters to cmdlets, a lot of what is happening isn’t apparent so it -can- be harder to get into some of the more advanced stuff, especially if you don’t have previous experience. Even just silly stuff like $arraylist.Add(Get-Date) - it’s difficult to see why this throws a bunch of errors.

Having said that there isn’t really a point it’s any harder than any other languages. Perhaps the only exception is digging into .NET runspaces and forms. I built and refined a form application in C# in about fifteen hours, the same application in PowerShell is taking a lot longer even though I’ve written it all before (and a lot of this is down to how basic the ISE is compared to Visual Studio), but I don’t consider this a negative point because it wasn’t really designed for forms and runspaces.

Personally I’d had some reasonable experience with C# and Dev Pascal plus rudimentary experience in a bunch of other languages, and picking up PowerShell has been the easiest of any of them. I did already have a good grasp of objects though so I don’t know if PowerShell is a good place to start to learn object orientation, what with it being so casual with them.

Just because the introduction to PowerShell is typically easier than other languages does not make it less of a “skill”. You can go way down the rabbit hole and work with some very complex PowerShell if you desire. You can start creating your own classes, etc… or even flip over to PowerShell DSC if you like.

It’s also becoming an almost ubiquitous Windows-based management tool for multiple large 3rd party vendors. Want to automate VMware? PowerCLI. Cisco UCS? UCS Powertool. AWS? AWS Tools for PowerShell. HP? HP Scripting Tools for Windows PowerShell. And the list goes on…

In the end programming or scripting is really an art form, no matter which language you use. The ability for you to understand the flow of logic and draft legible code with functional error checking is not language specific. There are just different languages for different purposes all with their own syntax for doing common structures (loops, conditionals, etc)

That being said, tools don’t have to be hard to use. I believe everyone who supports a Windows environment or supports other environments from a Windows machine should learn PowerShell. It’s a necessary skill of enormous value to you and anyone you support.

“Easier” depends on your experience.

  • I was a Perl scripter previously, so my transition to the syntax was super easy.
  • I was also a linear programmer from way back with Fortran as my initial foray into "real" programming. As such object-oriented programming was a challenge to me. I would get about half-way though chapter two of an OO book and my brain would just fuzz over. However, with PowerShell I totally get it and have come to really appreciate it. Get-Help and Get-Member are your best friends for the journey.
  • PowerShell is very much a learn-by-doing sort of success story. It's all about the little problems we have learned to live with that we know we could do better. Pick one or two of those and go tackle them. The sense of accomplishment will make you an evangelist and propel you down the road to greater PowerShell adoption.
  • Stop trying to solve world peace!!! It constantly amazes me the number of folks who want to launch into PowerShell with some overly complicated script they lifted from the Internet and then get discouraged or disappointed because it mysteriously doesn't work in their environment. Start small, learn the basics, and give yourself the grace to grow into the place where you, too can be an expert. It's a journey. Relax, breathe, enjoy it.
  • PowerShell is not the answer to everything. Be smart enough to recognize that. I know that may sound like heresy. But there will be times when a third party tool is the right solution. Yes, even if it costs money. Get over it and be prepared to make the business justification for the investment.
  • Good views.
    Bob, don’t get me wrong i love powershell. Have invested in many books and courses and find it very satisfying and enjoyable and have a hunger to become good at it. I was merely curious of peoples opinions. I would not be deterred as i have a passion for Powershell.

    Aw come on, Bob. If world peace can be brought about by anything, you know it’s going to be PowerShell! And I’m pretty sure PowerShell is the 42 of the Window universe :wink:

    Don’t get me wrong. I love PowerShell. I find it enjoyable and therapeutic. Have to get my “daily dose.” I’ve been doing PowerShell since the pre-V1 days of Monad. But I’m always a little leery of someone just starting out in PowerShell trying to take on the world – and I’ve seen it way more often than I care to admit.

    It is an absolutely essential skill to anyone who considers themselves to be a professional Windows systems person.

    Though it’s from 2011, this article is still relevant.
    “Is PowerShell Really the Only Future for Windows Admins?”

    I’m an IT pro of 15 plus years. I’ve been learning powershell for a year. It also gives me great pleasure to work with it. I’m not out to take on the world, but why would it be a problem if I did? I would need drive, skill and determination, not bad attributes to have I would say.

    I suggest you update your profile on the site. The nature of your question (is it easy to learn) did not give a hint of 15 years of IT experience.

    I spend a lot of time on spiceworks.com and powershell.com trying to help folks with their scripts. And I’ve seen way too many folks on their initial foray into PowerShell try to do too much right out of the chute, without understanding the basics. Even *nix shell scripting can be an asset, it’s in my background as well as the other things mentioned above.

    Even with years of PS experience I enjoyed doing the “30 days” book, but it took me three months to get through it. Life has a way of derailing your best efforts and I kept wanting to retrofit previous scripts with “new magic.” That said, I did indeed (old dog that I am) learn some new tricks along the way.

    If you are a lifelong learner, I can think of few things that will give you more pleasure than PowerShell.

    I shall update my profile, might even chuck a picture on ! I’m not old, 36, but the last year found this passion for powershell. I was curious to know peoples thoughts.
    I’m intrigued to know what might give me more pleasure than PowerShell…

    Dude, at the tender young age of 60, PowerShell just makes my day!

    Lol, I’ve got two kids and one on the way, they keep me busy ! PowerShell is my mental break ! :relaxed: