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. Perl user, looking for some power on the windows platform. Powershell might be the a good fit!!!

  2. With PowerShell, Windows Admins finally have a tool that is worth calling it that way. I’d like to see it through and get a firm knowledge about it. A good structured approach (for me also from the shell-starting-point) is much appreciated.

  3. @John Straffin, MS is actually moving away from the GUI for server products. If you are Windows Server admin, powershell is THE way you will be managing windows server in the future. Windows Server 2012 defaults to “Core” (non-GUI) installation, and ISV’s who want their software products to be certified on 2012 will need to make sure their software is able to be installed and managed in Server Core. Don Jones, co-author of the book talked about here, believes that the GUI is actually going away from Window Servers (see his comentary, here) In that case, powerShell will be the way t manage Windows Servers. If you manage windows servers, you will be using powershell. Might as well get on the bandwagon now.

  4. That sounds like a very interesting change in approach and one that could be useful. Our very small business environment is expanding just a bit and reading up on Server 2008 Powershell is really emphasized. The book sounds like just what would be useful for me to get up to speed on using Powershell to help manage things.

  5. I’ve taken a shot at Powershell a couple times, I just haven’t been able to quite figure it out yet, but I do like how it has the equivalent Unix commands for most Windows commands. I tend to mix them up when switching back and forth a lot.

  6. i’ve started using powershell more often lately. i’ve never been a enthusiastic command line user. i usually use the command line to run my own programs while testing or just to automate some repetitive task. maybe this book will correct that.

  7. We’re interested in leveraging PowerShell in our software deployment routines, particularly in its ability to stop and restart services.

  8. I always hated the fact that many tasks in windows required using the GUI or required using an API that take too long to learn. Everything in Unix could be automated in a script. Thank goodness for Powershell as this capability is so much more accessible now.

  9. Always meant to get around to learning PowerShell but never did. Perhaps a book like this will help me along!

  10. As more Microsft applications begin to leverage PowerShell it seems that I have no choice but to get better aquainted with this tool. I started getting my feet wet by doing some TFS Administration with PowerShell.

  11. One suggestion: If you really want to learn Powershell, replace any Command prompt shortcuts on your desktop / task bar with Powershell. It works just fine as a command prompt for pings, etc. and at least you’ll already be in the shell when you want to try something a little ‘spicier’!

  12. I love the title of the book – especially since that is so typical – to learn a new language during your lunch break. :)

  13. Powershell has revolutionized the way I work. Depending on the task, I think of it as a programming/scripting language, a fast way to access .NET types (e.g. System::DateTime), or as a shell. I’ve found it an excellent bridge between the anachronistic Windows command prompt and bash (thanks to a plethora of aliases), making the learning curve easy for users of either shell.

    It brings several things to the table that Windows’ command prompt didn’t offer — most important among them, in my mind, is the ability to navigate SMB paths as though they were local folders. It’s the rare occasion when I need to open Explorer for anything anymore.

    Frequent users might benefit from Console2 or ConEmu for their tabbed interfaces.

  14. Powershell is great on systems with .net. The problem arises when you are working on an antiquated system that cannot be updated or when you don’t have the latest fixes or don’t have .net installed. Most of our systems are on a private network. Some only get switched on for 2-3 months in a year. I find that I have to carry everything that is needed on a memory stick to update these systems if I wish to run powershell.

  15. I would love to win a copy of this. I’m a pretty decent DOS batch file programmer, but still need to learn PowerShell as my older servers get replaced.

  16. I’d love to learn PowerShell. Doing it in a month of lunches sounds like the best idea I’ve heard in a long time! Congrats on the book, and I hope I win it …

    Chris

  17. I’ve been using PowerShell for about two years now. Yes, mostly for scripting but I can see the point of the author. As a scripting language for windows it is very powerful. The integration is active directory is a huge benefit. I have a great collection. In a good IDE the code snaps together so quickly it’s really a lot of fun to code. PowerShell has a strong future in windows.

  18. Really Powershell is a phenominal tools because it serves both areas. Most command line scripting is too weak to perform more intensive tasks, and scripting engines usually provide convoluted object models to do what shells do very easily.

    I use it as a shell and as a software prototyping tool, and its great for both.

  19. Please add me to the list for the drawing. I’ve been wanting to use PowerShell to improve my productivity, and this book will help.

  20. Makes sense to teach/learn it this way. I occasionally open it up then sit staring at the “prompt” wondering what to do, and not really realizing it was and actual prompt!

  21. I started playing with powershell as a vbscript replacement, and found it annoying and a bit cumbersome. The default IDE isn’t that user friendly either. When I ended up using it to replace command prompt I found it powerful and fairly easy to pick up the basics.
    I think powershell is a great combination of these technologies, and look forward to learning more of it’s capabilities and seeing how it evolves. I’m certainly interested in this book.

  22. The more I mess with PowerShell, the more I feel as if it were designed mostly with IT admins in mind. Its power seems evident but it also paradoxically seems both overly terse and overly verbose at times. It also feels to me like a solution looking for a problem. But it’s the powerful shell that Microsoft has given us, so it’s time to start using it. I think.

  23. Looked at PowerShell back in the XP/Vista intro days. I was trying to use it to get around some DOS batch scripting limitations, but found it also had the same limitations. Hopefully it has come a long way since then.

  24. Personally, I think somebody at Microsoft should be dragged from his keyboard and bluescreened for making the transition from VBScript to Powershell so obtuse.

    Almost all of the system and network administrators who knew enough to script and automate their bread and butter more elegantly than DOS batch commands allowed accumulated years of experience scripting using Basic syntax (the exceptions being those crazed O’Reilly readers who used perl). Then we’re told that VBScript, our clumsy tool that we knew inside and out, is being deprecated and now we should embrace this new Powershell. Did any of the bright C# programmers who came up with this nifty new tool think that it might, just might, make sense to ease all those Basic-literate admins into the new system instead of telling us to:
    (1) Trust Microsoft that it’s a wonderful tool;
    (2) Forget everything you’ve already scripted, and
    (3) Embrace the curly brackets and other syntax so beloved by programmers and sysadmins who Don’t Like Vowels.

    Given that the .Net framework which Powershell is built on supports writing programs in both Basic- and C-style syntax, why couldn’t Powershell offer Basic syntax to lower the barrier just a smidgen for all those VBScript gurus?

    Just my 2 cents’ wroth…

  25. Power shell has replaced VBScript, This is great as we now have the power of the .Net framework to script shell tasks. Next swap out VB for applications with power shell. The power that will be available within the Office range would mean that applications could be developed with little effort and money. Enhancing the power of office applications and the value of office to organizations. VB .Net would then become a learning platform (if you clean up the syntax to avoid bad habits).

  26. I’ve been wanting to learn PowerShell for a while now and I have started that thing some times. But as soon as I’ve run a few things I feel overwhelmed and then I get something else to do. Maybe this book would help to actually get me past that threshold. I would love to win a copy of that book!

  27. Ted McLeod-Morris

    I live at the command line in Unix, and I’ve always been puzzled by the Windows attitude towards shells. I’ve dabbled with Power Shell but it isn’t a daily requirement so I haven’t invested a lot of effort in using it.
    Of course, with a spiffy book to help, I’d change that situation quickly.

  28. So far, my experience w/PS has shown its commands to be too wordy to be an efficient command line set–at least when compared to the UNIX command set. As a result, I live in cygwin. Maybe the sources I’ve used to learn PS are too-geared to new users who need a verbose command set, and a shiny new book can disabuse me of this perception. :-)

  29. [responding to Paul in comment 133]
    “Next swap out VB for applications with power shell… VB .Net would then become a learning platform (if you clean up the syntax to avoid bad habits).”

    Spoken like a true C-syntax bigot.

    Leaving aside the R-war issue of supposed syntax superiority, you are almost completely forgetting a fundamental rule of applications: they exist to make users more productive. Basic-style syntax, with its roots in Basic as an educational language, presents a significantly lower learning threshold to users wanting to automate tasks in Office applications than expecting them to deal expertly with the curly brackets and semi-colons which “real” (a.k.a. C-something) programmers use.

    I am not saying that Basic is the best language, just that it is a better language for beginners. I dislike over-generalizing, but I would wager that my story would be familiar to most VB and VB.NET programmers: I got started with .NET programming because I had a problem to solve, and using VB.NET instead of C# allowed me to spend a lot more time on thinking through the process I was developing than learning how to code correctly. That meant that my VB.NET application was working sooner and running more efficiently (ultimately, about 2 orders of magnitude better) because I had time to test and refine instead of struggling to successfully compile to p-code.

    That’s why I think creating a VB-friendly face for Powershell is important.

  30. The greatest limitation I’ve seen in Powershell is the way it loads everything from a command before processing it. Thus, some of the commands that could be so powerful perform very poorly when pointed at a large collection of data. Sometimes this makes anything but a looped construct nearly impossible, like for example, searching a very large directory structure for files over a certain maximum size, or searching a large AD in some ways.

  31. I’m wondering if I should become a PowerShell fan, vbscript seems to hit the mark on most everything I’ve needed. – I would also love a copy.

  32. I am trying to write an installer in PowerShell + MSBuild I would love a copy for some things I am doing, like installing roles for a server etc.

    Thanks
    Jeff

  33. Hopefully this has been fixed
    The OS handle’s position is not what FileStream expected
    PowerShell -Command ‘”start”‘; Write-Error “Foo”; ‘”end”‘ > c:tempredirect.log 2>&1

    Very limiting when trying to run PowerShell scripts from batch files, CtrlM and other scheduling software.

  34. @138
    That’s why I think creating a VB-friendly face for Powershell is important.

    Hah! I’m coming at it from the background of a ‘windows guy who jumped to unix admin in 2000 and is now an odd duck: 70% unix, 30% windows’.

    Of course, 70% of my _problems_ are with Windows …

    Anyway. From my POV a ‘bash’ friendly face would be the cat’s pajamas.

  35. @144

    From my POV a ‘bash’ friendly face would be the cat’s pajamas.

    Was just playing with PowerShell as a command line interface as suggested here. It seems the kludgy commands are aliased to more familiar ones, e.g., Get-ChildItem can actually be invoked by typing “dir” or even “ls”! It seems that the switches aren’t aliased though…

  36. It seems the kludgy commands are aliased to more familiar ones, e.g., Get-ChildItem can actually be invoked by typing “dir” or even “ls

    Hooray!

    It seems that the switches aren’t aliased though…

    Two steps forward, one step back.

  37. PS is something I have to learn to better myself and my work wizardry. However, finding the time and mental energy to learn a new language is the real blockade. Who has time for such things when a full time job and family come first? I guess a book will just have to be read regardless, one way or another.

  38. I’ve been approaching powershell as more of a shell that has programming. I’ve been doing lots of file manipulation tasks in it instead of dos.

  39. I learnt C Shell from the C Shell field programming guide but it taught how to use. The shell first rather than treat it as programming language.

Comments are closed.