diTii.com Digital News Hub

Sign up with your email address to be the first to know about latest news and more.

I agree to have my personal information transfered to MailChimp (more information)


Windows PowerShell

Before we get into Powershell though, let’s look back at how PowerShell came about.  Ever since MS-DOS and the earliest versions of Windows, there has been a command line tool.  The problem was that not everything that could be done via the User Interface could be done via the CLI.  With the introduction of Windows Script Host (WSH), we were able to overcome some of the shortcomings, but we never really had true shell integration.  In 2004, Microsoft started the development of Monad (aka the Microsoft Command Shell).  The goal of Monad was to provide an extensible command line interface shell and scripting language through which a range of core administrative tasks could be performed.

OK – so enough of the PR – on with the technical!  PowerShell runs on XP SP2, Windows Server 2003 SP1 / R2 and higher, Windows Vista and Windows Server 2008.  A customized version of PowerShell ships with Exchange 2007.  In order to install and user PowerShell, you have to install the .Net Framework v2.0.  Think about PowerShell in these terms – “it exposes the power of .NET in an Admin-friendly way” (from the Windows PowerShell team Blog).

Windows PowerShell defines several types of commands that you can use in development.  These commands include: functions, filters, scripts, aliases, and executables (applications).  What we are going to look at is a simple, small command called a “cmdlet” (pronounced command-let).  A cmdlet is a simple command used for interaction with any managed application, including the operating system.  It is analogous to a built-in command in another shell, such as Cmd.exe, KSH, or BASH.  The traditional shell generally processes commands as separate executable programs.  Each program has to parse the input, distinguish between positional and named parameters, bind values to the correct parameters, format the output, and display the output.

By contrast, Windows PowerShell processes commands as instances of a .NET class, focusing on the simple cmdlet model.  You must provide the parameters and validate the values, and then furnish details of object types and formatting.  Windows PowerShell does the rest of the work: parsing the parameters, binding them to their values, formatting the output, and displaying the output.  So let’s take a look at some quick examples.

The first example, we’re going to look at is getting a list of processes.  At the prompt within PowerShell, enter the following command: get-process.  You should get output similar to the following:

Full Article

Additional Resources:

Microsoft, Windows, PowerShell, Knowledgebase

Share This Story, Choose Your Platform!

Do NOT follow this link or you will be banned from the site!