Learn PowerShell as a shell first

When I was learning PowerShell, I thought of it as a scripting language that has a shell. But the right way to think of it may be the opposite, a shell that has a scripting language. Apparently others have followed this same change of perspective.

Don Jones and Jeffrey Hicks open their new book Learn Windows PowerShell 3 in a Month of Lunches by explaining that they first saw PowerShell as a VBScript replacement and taught it that way.

Since late 2009, however, a shift has occurred. More and more administrators who don’t have prior VBScript experience have started trying to learn the shell. All of a sudden, our old teaching patterns didn’t work very well, because we focused on scripting and programming. That’s when we realized that PowerShell isn’t really a scripting language. It’s really a command-line shell where you run command-line utilities. Like all good shells, it has scripting capabilities, but you don’t have to use them, and you certainly don’t have to start with them.

[Don Jones wrote the first edition of the book, which I haven’t read. This quote comes from the second edition, coauthored with Jeffrey Hicks.]

Other PowerShell books I’ve read felt more like a programming language book than a book on a shell, more like, for example, The C Programming Language than The Linux Command Line. The latter seems to be a better analog for the new PowerShell 3 book: emphasis on interactive use first, programming second. At least that’s my first impression. The book isn’t finished yet—it’s part of Manning’s Early Release program—and I haven’t yet read all of the part that has been released.

If you’d like a chance to win a copy of Learn Windows PowerShell 3 in a Month of Lunches, please leave a comment below. I’ll draw a winner and the publisher will send you a copy of the book.

Update: I’ll draw a winner on Friday, June 29. Comments need to be posted by midnight Thursday in my time zone.

Related links

156 thoughts on “Learn PowerShell as a shell first

  1. Interesting! Being an intern of Microsoft this summer, I hope I can take advantage of PowerShell. BTW, I’d love to win the copy, though I’m in China

  2. I’m interested in learning Powershell. I’ve had a on again, off again relationship with it since v1 came out, but something formal would go a long way to re-establishing it as a tool in my arsenal.

    Thanks.

    Jay

  3. Personally, I want to learn PowerShell because I want to automate tedious tasks within Visual Studio.

  4. Well, I started learning Powershell since Exchange 2007 make massive use of it. Powershell is powerfull but Not easy to master.

  5. Great article. I would like to learn powershell to help my
    Co-workers automate some of the daily maintanence
    That we are required to do everyday.

    Cheers everybody.
    Jorge

  6. Ricardo Panaggio

    A good shell for Windows seems unbelievable. But I’ve seen a great hype behind PS these days. Maybe it has finally solved this Windows issue :)

  7. Here is my comment: when are you going to draw the winner?

    BTW, I enjoy your blog, even if I do not understand some of your posts. They can be way above my head.

  8. Billy Wayne McCann

    Always been interested in learning posh so that I wouldn’t have to use the somewhat clunky cygwin. Maybe I can get this book! Love your blog.
    BW

  9. I’ve only recently started exploring Powershell because of a need to manage both an on-premises Exchange server and an Office 365 subscription. Thinking about it from this other direction (shell –> scripting) will help I think.

  10. I’ve written a bunch of PowerShell scripts over the last weeks. There is one other aspect that is great about PowerShell that hasn’t been mentioned: if you do need to go complicated, you can. In my case I ended up with a need to call some functions in the Win32 API. Doing that was not super straightforward, but in the end I was able to do it all in my PowerShell script: you can declare a C# class in your PowerShell script with Add-Type, and in that C# class I declared the Win32 API functions as PInovke methods and was then able to call the Win32 API functions directly from my PowerShell script. I found this incredibly powerful.

    No need for the book here, haven’t read a tech book in a very, very long time ;)

  11. I’m currently finishing up my second course for PHP and MySQL so PowerShell sounds like something I should start learning next. I would love the opportunity to get a copy of the book and get started. I’m nearing the end of a web development program in school and this would be a great tool to add to the resume.

    I’ve now been introduced to PHP, SQL, JavaScript, ActionScript and jQuery so I’m no stranger to scripting, but it sounds like this book takes a better approach to getting database management and account services up and running in a .NET environment. That’s something I’ve had no training for so this book would be the perfect place to start.

  12. I am still trying to get hang of powershell v2 and get others to use it and now they come with the version 3. Still, love to get the book.

  13. I’m a frustrated DBA who likes programming, but the job doesn’t have that scope – other than SQL. However, I believe Powershell will justifiably give me that avenue, so I would like to learn it!

  14. This book sound like a good way to get started into PowerShell scripting. I’ll check this book out! Thanks

  15. Interesting proposal, but how useful is it to tell folks “use it as a shell first” when MS has been pushing them to the GUI for so long? I know plenty of IT folks who are practically allergic to the command line.

  16. While it’s true that PowerShell is a shell, it’s important to note that it is a scripting language too, and this was a deliberate consideration in its design. There are plenty of books on PoSH that cover its history and development and all document this fact.

    Personally I use it as a shell, when it’s easier to quickly get information or make changes using a one-liner that I don’t have to reference, but the fact is what puts the ‘power’ in PowerShell is the ability to script bulk or repetitive tasks. There are things you can do in PowerShell, especially in PoSH enabled applications such as Exchange or VMware, that would have prohibitively labour-intensive without it.

    I’ve seen full blown interactive desktop applications created with PoSH, and I’ve seen tap-happy admins do their entire day’s work using nothing more than a handful of PoSH console windows and no MMCs. Personally I think if you’re going to teach it, show people how powerful a tool it can be in both contexts, and let them fit it into their productivity chain their own way.

    -Matt

  17. Shameer Pradhan

    want to try out PowerShell as it seems it can be powerful yet intuitive to use

  18. I have been wavering between learning AutoHotkey to automate tasks (because I like Autokey in Linux) and powershell. Your blog post made me think that powershell is the way to go. Also, I would love to win the book.

  19. I’ve been using shell in both the Windows and Unix arenas for many years. I have not had the time or inclination to learn Power Shell, but I now have the time.

  20. I’ve been using TakeCommand (formerly 4Dos) for over a decade, and plan to learn more about Powershell.

  21. As an IT admin who has got by with primarily writing batch files to get things done, I can relate to this strategy of learning powershell. I remember well the days of DOS so throwing together a batch comes naturally on a daily basis.

    VBS, on the other hand, is the only other type of script I really use and everything I do use is from finding something on the net and hacking about to make it do what I want it to.

    Based on this not-so-much-a-programmers perspective, I can see how this idea and this book could help me tackle powershell, which is definitely on the to do.

  22. Yes the email is real. ;)

    I’d love a peak. I’ve done some MEAPs in the past, and tried to help out with my OCD proof-reading. Sign me up!

    D

  23. After being tossed into the sharepoint world powershell has become a mandatory item to learn. While the Web UI’s do a bunch of the work some things really only work well in powershell. Granted it’s “sharepoint powershell” but that just means a few different commandlets with focus on sharepoint. Since learning the wonders of how to muck my way with the commands I started working to learn powershell overall for all my other admin tasks and such. With the few books I’ve looked at your right most treat it as if I’m building out a full on application. Heck all I need is to code a cute UI and I would have a windows OS worthy wizard, but it’s super hard to learn that way and I think I only survived because I am a programmer. I find myself trying to convert the program learning methods to a learn the shell method for my co-workers, I can’t wait to see this book, cause I might be able to just sit a copy down on their desk and not have to translate as much. LOL

  24. Man, I’d love to get my hands on that book. Been avoiding PowerShell because it’s always been promoted and taught like a new programming language. One teaching it like a useful tool instead of a new programming language I’d have to learn would be helpful.

  25. We took on a new hire to manage our build process, and he’s doing most things with PowerShell. I don’t want to be left behind!

  26. This post reminded me of my bat files that I use daily and how I use both DOS commands as well as python to work together in getting things done easier in code. Also that I need to refactor some of those scripts to increase code reuse.

    But getting more familiar with PowerShell and its shell as the language could just simplify my life and I just use one tool instead of two to get the job done. May just have to check it out and see how fast I can pick it up, that is one of the biggest decsion points for me, is how fast I can pick up a tool and start doing something useful with it, if it is too difficult I will just drop it and continue the way I do things, and then when resources help explain the tools better and help me completely understand the process and how the tool executes actions with reasonable performance then I start shifting over to that tool.

    Good resources and references for a tool are just as important to me as a good tool itself. Hope that that book is counted as one of the good resources for this tool.

  27. This sounds like the book for me. I have been trying to teach my self how to use power shell for windows active directory management and daily monitoring task.

  28. would like to explore the power of PowerShell. seems to be a powershell is more than a scripting language so it would definitely help over any other scripting language.

  29. Looking forward to a book that can finally help me better understand proper cmdlet creation and effective use.

  30. I have been playing Jack-of-all-Trades for a developer group for sometime and found that I was doing installations over and over again. I started looking into Powershell as a way to automate some of that repetitive configurations. I would love to get the book as I know I have a lot still to learn in Powershell.

  31. Carter Mitchell

    I tried my hand at PowerShell last year as an aid to migrating a complex web site to a new server, simultaneously migrating our database server and switching from SQL Server authentication to Windows authentication.

    Learning was piecemeal, and I’d very much like a much more structured learning experience, as I believe that I’ll have many more opportunities to use PS in the future.

  32. I’ve been intending to learn about Powershell “sometime”, though I don’t need to do much command-line work so I haven’t learned much yet. My interest is mainly to replace batch scripts and VB – so it’s interesting to read about this different approach to it.

    Of course, I’m mostly replying because I want a chance to win a copy of the book ;) (Which is very generous – whether I win or not, thanks!)

  33. Powershell is becoming unavoidable. My only hangup is that it is so verbose. Other than that, it is a very powerful scripting and command line tool. I would love to explore in detail its integration with the Microsoft .NET framework.

  34. I’m a long-time Unix/Linux shell user who hates working in the old cmd.exe environment. Every time I had to write a batch file for something it felt like I was being handed some crude tools and a rock, tasked with inventing another wheel.

    However, the last year or so I’ve been working mostly .NET projects and have also increased my exposure to Powershell. I have to say it lives up to the name admirably, but it’s definitely a different animal to the *nix shells I’ve spent so much time with. I do wish it integrated better into Visual Studio though, it seems odd that Python is well-supported in VS2010 but Powershell isn’t.

    The approach of learning Powershell as a shell first and then putting the bits together to write scripts makes sense to me; it’s how I originally learned the Unix shell.

  35. In MS-Orchestrator, powershell is “used” as one main “Programming-Language” :-(

  36. I have wanted to learn powershell, but have found no good place to start. Maybe this book is what I need.

  37. I’ve been using PowerShell more frequently and need to dive deeper. This book looks like a good way to start.

Comments are closed.