Ezine 179 Learning Microsoft’s PowerShell

Ezine 179 Learning Microsoft’s PowerShell

A new year begins.  January is traditionally the time for learning a new language, or renewing promises to master skills that we had started, but abandoned.  The purpose of this ezine is to encourage you to take the first steps in mastering Microsoft’s PowerShell.

This Week’s Mission

This Week’s Mission is to explain what PowerShell is, and to offer reasons why you should use PowerShell to control your operating system.  The most important reason is that it’s such a joy to feel the power you get from typing just a few verb-noun combinations.

From the point of view of learning PowerShell, there are two groups of students, a smaller group of programmers and developers, and a bigger group of server administrators and dabblers.  It is this second group that I aim my articles.  Typically they would have been DOS experts in a previous computer generation.

What Is PowerShell?

PowerShell means different things to different people; it depends if you are an administrator, troubleshooter, dappler or developer.  If you have previous experience of DOS or VBScript then you will look for specific things from PowerShell – you will not be disappointed.

  • PowerShell could be portrayed as a command-line to configure the operating system.
  • A quicker alternative to GUIs for inspecting and changing settings.
  • A replacement for scripting languages such as VBScript or KiXtart.  For instance, working with WMI and writing to text files is much easier.
  • A basic Knowledge of PowerShell is essential for configuring some settings in Exchange 2007 and Windows Server 2008.
  • PowerShell could be described as a modern day DOS.  Indeed a classic way to get started is simply to continue using DOS commands but in the PowerShell command-line.  You can also issue built-in commands such as ping or ipconfig from within PowerShell.

In summary, PowerShell has lots of gears.  The good news is that EVERYONE can test PowerShell in first gear.  The basic commands are short, powerful, and easy to understand, for example: get-service.   Or get-service | where-object {$_.Status -eq "Running"}.

Two more pieces of encouragement, PowerShell’s help is wonderful, from the previous example just try: help get-service.  Also troubleshooting errors is easy, just read the on-screen line number – very carefully.

Why Learn Microsoft PowerShell?

I encourage you to learn PowerShell because it will save you time when configuring or interrogating Windows Server, Vista or XP.  Previous generations found DOS commands a life saver in managing their operating systems.  But the advance of the GUI made the dark world of DOS superfluous.  However, in a surprising development, GUIs are becoming a victim of their own success; there are so many windows and menus that techies cannot find the setting they want quickly.  Many Microsoft aficionados realize that after all, there was merit in a UNIX style command-line.  PowerShell delivers a huge payload from just typing a few verb-noun commands.

If you don’t have at least a working knowledge of PowerShell, and the basics are easy to master, then you are going to get a sense of modern operating systems leaving you behind.  So learn the rudiments of PowerShell, and keep up-to-date.

The secret of plucking up the courage to learn PowerShell is to realize that it is not just for programmers and developers.  Ordinary administrators can soon use PowerShell to extract all sorts of information from their operating system, for example, which process are running, the last 20 errors in the system eventlog.  It won’t be long before they are issuing commands to create Exchange mailboxes, or change a batch of users’ properties.

Three Things Guy Guarantees If You Do Lean PowerShell

  1. If you do try PowerShell you will gain instant success and gratification.  This is the easiest computer language to get started.  You will soon move from basic commands to short scripts.
  2. It may therefore seem strange when I follow-up by saying, ‘You will never become an expert at PowerShell’.  The reason is that, PowerShell has all the complexities of a programming language, and ordinary techies won’t have the time, or the need, to master the developer side of PowerShell.
  3. Learning PowerShell is both fun and satisfying.  Moreover, it will truly make you better at your day job of managing a Windows operating system.

Guy Recommends: The Free IP Address Tracker (IPAT) IP Tracker

Calculating IP Address ranges is a black art, which many network managers solve by creating custom Excel spreadsheets.  IPAT cracks this problem of allocating IP addresses in networks in two ways:

For Mr Organized there is a nifty subnet calculator, you enter the network address and the subnet mask, then IPAT works out the usable addresses and their ranges. 

For Mr Lazy IPAT discovers and then displays the IP addresses of existing computers. Download the Free IP Address Tracker

Installing PowerShell

In my opinion PowerShell is the 3rd most difficult Microsoft program to install.  However the task becomes easy once you realize that PowerShell needs a specific version of .net framework for your operating system.  To be fair, the PowerShell installation prompts you for .net during the setup. 

It also helps if you realize that from Windows Server 2008 onwards PowerShell will be a part of the operating system.  You just choose whether to turn this ‘Feature’ on or off.  Consequently XP, Windows Server 2003 and even Vista are in a transitional state where you need to install PowerShell and .net framework, which then become part of the operating system, (and not an independent utility).  Incidentally, this makes an uninstall more of a challenge than your average third-party utility.

This Week’s Challenge

My challenge to you today is to go to Microsoft’s site and download the version of PowerShell and .net Framework for your operating system.  Here is the PowerShell download link.

Guy’s Sadness at the Present State of PowerShell

What makes me sad in January 2009 is that we are on the cusp of PowerShell version 2; yet to save conflicts we must stick with v 1.0 for production machines, and only use the CTP (beta) version 2 on test machines.

This Week’s Secret – Guy is Awarded MVP Status

Microsoft awarded me an MVP in PowerShell.  While I regard this award as the greatest of my numerous academic achievements, I choose not to display the MVP logo on my site.  My reasoning is this:

All the other MVPs are truly wiz kids with deep technical knowledge; I am just someone with a mission to introduce non-technical people to PowerShell.  Technically, I am not fit to lick the boots of other MVPs.  However, no-one is more passionate than I in persuading people to try PowerShell.  It really is both easy and a joy to learn.

In some quarters it has become fashionable to knock MVPs.  I would like to take this opportunity to answer such criticism and give an insiders view of the MVPs.  They are indeed a disparate bunch of techies, some MVPs are even teetotal!  It may also surprise you that when we meet Microsoft staff, MVPs are extremely critical and merciless in pursuing weaknesses in Microsoft products. 

As is usual at (MVP) conferences it’s talking with the other delegates during breaks that is the most useful part of the event.  One delegate noticed that all MVPs had one feature in common – they are all givers.  MVPs are givers of their time, and givers of their expertise to help others.  Some impart their knowledge via newsgroups, others by running usergroups, I give to the computer community via this ezine and via the material on my website.  Lastly, the award is only for one year, then it can be renewed, else it expires.  This provides a mechanism to remove people who no longer contribute, or who abuse their MVP status in any way.

Where Next?

Once you have installed PowerShell, I will help you by publishing fortnightly articles which cover the basics.  I will provide worked examples illustrating how PowerShell can operate at that divide between work and pleasure.  You can also see previous articles on the Computer Performance website.

Guy Recommends: Tools4ever’s UMRAUMRA The User Management Resource Administrator

Tired of writing scripts? The User Management Resource Administrator solution by Tools4ever offers an alternative to time-consuming manual processes.

It features 100% auto provisioning, Helpdesk Delegation, Connectors to more than 130 systems/applications, Workflow Management, Self Service and many other benefits. Click on the link for more information onUMRA.

If you like this page then please share it with your friends

 


See more Microsoft PowerShell tutorials

PowerShell Tutorials  • Methods  • Cmdlets  • PS Snapin  • Profile.ps1  • Exchange 2007

Command & Expression Mode  • PowerShell pipeline (|)  • PowerShell ‘where‘  • PowerShell ‘Sort’

Windows PowerShell Modules  • Import-Module  • PowerShell Module Directory 

If you see an error of any kind, do let me know.  Please report any factual mistakes, grammatical errors or broken links.