Pluralsight blog Where devs, IT admins & creative pros go for news, tips, videos and more.
Pluralsight + Digital-Tutors - 3,000 tech & creative courses - starting at $29/month Get it now →
January 30, 2008

Take Command of Server 2008 with Windows PowerShell – Part 1

By

Since the earliest versions of Microsoft Windows, the command shell has existed in some way, shape, or form.

The command shell evolved from direct entry into Windows underlying DOS environment to an emulated DOS Environment in later Windows versions. All the while the command shell has made strides to maintain backward compatibility with the original DOS environment, however, little has been done to expand upon the capabilities of the command shell.

Utilizing the power of the .NET Framework, Microsoft has released a brand new command shell environment aptly titled Windows PowerShell.

Introducing: Windows PowerShell

Like its predecessors, Windows PowerShell supports all the previous command shell commands such as “cd” to change directories, and “dir” to list directory contents, and converting your old batch files to PowerShell scripts is virtually effortless. But don’t be fooled by the fact that PowerShell can execute old commands and batch files. PowerShell is run by a brand new command set consisting of some 120 cmdlets.

Cmdlets make themselves useful within each of the PowerShell providers. Providers are objects that store their data in a structure navigable like the Windows File and directory system. In fact, the default PowerShell provider is the FileSystem provider, which gives access to the files and folders stored on the system drives.

PowerShell’s automation and time saving capabilities become apparent when you take advantage of three key features.

  • Pipelining command objects together
  • Multiple commands separated by semicolons on a single line
  • Powerful and flexible scripting engine

With all that, PowerShell not only acts as a replacement to the standard Windows Command Prompt, in many ways its usefulness as an administrative scripting engine exceeds that of VB Script. PowerShell scripting can accomplish virtually everything VB Script can and do it with greater efficiency in several areas.

Installing Windows PowerShell

Now that you have heard of this new tool, you are probably wondering how to get your hands on all that power?

Like most of Windows Server 2008’s useful features, Windows PowerShell is not installed as a default Windows Component. This is mostly because Windows PowerShell is dependent on .NET Framework 2.0 or higher being installed.

Assuming your installation of Server 2008 meets these requirements, PowerShell can be installed by following the steps below:

  1. Open the Server Manager from Start | Control Panel | Administrative Tools | Server Manager
  2. From the Server Manager Click Features then click Add Features
  3. Check the box labeled Windows PowerShell and click the Next button
  4. Click the Install button to confirm installation and wait
  5. When the installation is complete, click the Close button to exit the Add Features Wizard

Accessing Windows PowerShell

With PowerShell now pleasantly residing on your server, all that is necessary to bring the power to your fingertips is launching it. Like many Windows features, PowerShell can be accessed more ways than one. Below are the basic methods for accessing PowerShell.

  • Start | Run | PowerShell.exe
  • Start | All Programs | Windows PowerShell 1.0 | Windows PowerShell
  • From the standard Command Prompt by entering PowerShell.exe

If you prefer, you could also copy the PowerShell shortcut from the start menu to the desktop or quick launch tool bar for easier access.

But Wait! There’s More

That’s all for today, but don’t worry, in the next few weeks, you will have the opportunity to get fully acquainted with Windows PowerShell through a series of articles, this one being the first.

The main goal of this series is to show you the capabilities and proper usage of Windows PowerShell. So that after reading all the articles you will be familiar with the following:

  • Installing and Accessing Windows PowerShell on Windows Server 2008.
  • Launching the PowerShell command console.
  • Executing cmdlets and working with the objects returned.
  • Using the different PowerShell providers to work with server resources inaccessible from the FileSystem provider.
  • Using variables to store and reuse objects in PowerShell.
  • Customizing the user interface of PowerShell with the PowerShell profile.
  • Taking advantage of the script engine to automate the performance of Administrative tasks on the Server.

About the Author

(A+) is experienced in both IT and development. He has completed training in computers, electronics and networking and obtained his A+ certification. Jason is a self-taught developer and over half of his career in technology has been in web and Windows development, while the rest has been IT orientated. He hopes to be able to use his cross industry expertise to be able to shed more light on the exciting life of a developer for those in IT considering making the move to software. Jason has written articles on various topics including SharePoint, CompTIA A+, and Windows Server 2008.


Discussion