Ramp Up Guide: PowerShell

Ramp Up Guide: PowerShell

  • Comments 5
  • Likes

Hi everyone. My name is Andy Dring, and I’m a Premier Field Engineer at Microsoft. I want to share some of my experiences learning and using PowerShell, and let you in on some of the techniques I’ve used to become proficient in using it. I want to go through the following:

  • Understanding PowerShell
  • Understanding of Basic Concepts
  • PowerShell in Practice
  • Technology-specific PowerShell
  • Breaking News
  • Resources

 

Understand PowerShell

As I suspect is the case for most of you reading this, I started off using PowerShell as an IT Admin before I was employed by MS. I was driven by a need to accomplish a task, but once I’d started learning the language, the possibilities showed themselves all over the place. So the first piece of advice I’d give is to find a problem to solve, and solve it. This may be as simple as translating an existing script from another language into PowerShell, or it may involve writing something that will manage your entire estate for you while you put your feet up – note, if it’s the latter, I will require a copy sending through…  

The first key point is to understand what PowerShell is, and what it’s not:

  • PowerShell is more than just a scripting language; it’s a full object-oriented programming language. This does mean that any prior programming experience will be beneficial, but it’s simple in its implementation, and uses common concepts.
  • It is consistent, and chock full of descriptions, syntax guides and examples.
  • It is designed to help admins and others wishing to script tasks, and the built-in help is designed in this way, to assist admins who aren’t familiar with programming techniques to get the most out of it.
  • It is not going anywhere – it is applied across most current MS products, and will be in new ones for the foreseeable future, which means that once a technique is acquired, this can be rinsed and repeated across Windows Server, AD, Exchange, SQL and many other technologies, and any investment of time or money spent learning it will reap rewards for a long time to come.
  • Most importantly of all, it is not scary, and it’s not difficult to quickly start writing your first scripts.

 

Understanding of Basic Concepts

With the above said, the next step is to begin to understand PowerShell and its basic concepts:

 

Something a little more hands on:

And a structured course including demos and labs:

 

PowerShell in Practice

Once you’ve achieved a level of comfort with PowerShell itself, you’ll want to start putting it in to practice. Each major Server Technology ships with its own PowerShell module or snap-in, so there is one for AD, Exchange, Sharepoint etc. These are outside of the scope of this article, but there will be some links at the bottom to help you to find resources to learn about these.

In order to start using PowerShell usefully, here are some server management specific resources:

You’ve probably also got scripts written in VB that you would like to convert to PowerShell. Well, we can help with that too:

Finally, there’s a follow-up course to the one above that builds and introduces more advanced concepts:

 

Technology-specific PowerShell

Once the fundamentals of PowerShell are understood, applying them to any given technology is simply a case of learning the cmdlets for that technology and then implementing the techniques. Here are a few links to cmdlets for some common technologies:

Alternatively, using get-command –module <modulename> will list all the commands contained in that module, e.g. get-command –module ActiveDirectory will show all the commands loaded by the ActiveDirectory PS module

 

Breaking News!

Just as I was finishing up writing this post, CTP1 was released for the Management Framework 3. There’s a post on the PowerShell blog, which also links to the download, and I’d be very surprised if there weren’t some really cool features coming. Bear in mind that this is the version that will ship in Win8, so get comfortable with it now to give yourself a headstart when Win8’s released. But do yourself a favour, don’t put it on your primary machine, because it’s only pre-release code at the moment!

 

Resources

The MS Events site

The MS Events site is a one-stop shop for all sorts of webcasts, podcasts and virtual labs. The link is to a search for PowerShell specific posts, but there are a lot of other resources for other technologies too.

 

Blogs

 

Code Repositories

  • The Scripting Games is an event held by the Scripting Guy to provide problems to enable you to learn PowerShell. So if you’re stuck finding a problem to solve, check it out and try to solve them. Answers are available too, so you can check how you’re doing.
  • The Code Repository contains scripts submitted by both MS employees and PS enthusiasts.
  • The PowerShell Guy's Blog is another site containing code samples and discussion.
  • PowerShell Code Repository has more for you to enjoy.

 

Hope this helps

Andy Dring

Premier Field Engineer

Microsoft Premier Support UK

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • <p>Nice write-up! &nbsp;I&#39;ve been waiting for you guys to come out with this since discovering your Ramp Up Guides.</p>

  • <p>Nice compilation of material. This will help me do a presentation by serving as a rough outline.</p>

  • <p>Following an onsite discussion I had with one of my customers this morning, this could be just what he needs. &nbsp;Glad I remembered about this Ramp Up Guide !</p>

  • <p>Thanks Andy, very useful.</p>

  • <p>You don&#39;t seem to address PowerShell&#39;s fatal flaws. While it improves upon a few aspects of cmd.exe (mostly fixed with wrappers, such as PyCmd), it also leaves off several vital features that even the horrible cmd.exe supports (such as &amp;&amp; and || operators). While it sounds like a good idea to base a shell on objects, in practice it doesn&#39;t really work very well. All of the software is either using standard objects or is incompatible. You&#39;re better off using simple UNIX-based standard streams and letting each piece of software offer options to shape it how you need it. While standardizing option parsing was a good idea, it turns out that Microsoft is terrible at command line syntax and the resulting option parsing is utterly impractical. The result is that PowerShell makes few improvements to cmd.exe, ends up being needlessly complicated to use, and still falls a long way short of UNIX-like shells that have existed for decades.</p>