Download PowerShell - Microsoft's New Command Shell
Get your Copy of PowerShell Installed
One of my themes with Windows PowerShell is that nothing is too simple. Therefore, let me start by checking that you have downloaded and installed the correct
PowerShell files. If indeed, you have PowerShell installed and functioning correctly then go to my 'Execute Commands' page.
PowerShell Downloads
It breaks my heart to send
you away from my site, but if you have Vista then it is essential that you get a copy of PowerShell and .NET Framework from Microsoft's own site.
PowerShell itself
PowerShell has moved forward from a download, to merely ticking a box in the
Control Panel, Programs, and then 'Turn Windows feature on'.
Key point, for these old systems you need to download an operating specific version of PowerShell:
.NET Framework PowerShell is an
object based scripting language, consequently, it needs .NET Framework for the definitions of the Windows objects. PowerShell works fine with either .Net Framework v 2.0, or v 3.0.
Here are the three stages before you get up and running with PowerShell:
Obtain, then install .Net Framework 2.0
Get a copy of PowerShell, for example v1.0 (2.0 in 2008)
Start, Run, PowerShell.
Once you have installed PowerShell (and .Net), try this simple command: $Host
Here opposite is a screen shot of what you should see: Version 1.x.x.x
As usual, there are two ways of doing
everything, you could try. Get-Host
Guy
Recommends: Free WMI Monitor for PowerShell
Windows Management Instrumentation (WMI) is one of the hidden
treasures of Microsoft's operating systems. Fortunately, SolarWinds
have created a
Free WMI Monitor so that you can discover these gems of performance
information, and thus improve your PowerShell scripts.
Take the guess work out of which WMI counters to use when scripting the
operating system, Active Directory, or Exchange Server. Give this WMI monitor a
try - it's free.
The Situation with PowerShell and the Operating System
Previous scripting programs came 'built-In' to the operating system. DOS
has its cmd.exe, while VBScript has cscript.exe as its
scripting engine. As of 2007, no commercial operating system, not even Vista, has PowerShell 'built-In'. Fortunately, installation is one of Microsoft's strengths, thus obtaining both
PowerShell and .Net Framework is an uncomplicated one-off task.
PowerShell Runs on these systems: Windows Server 2003, Windows XP and even Windows Vista, however each has their own version of PowerShell.
Getting Started - PowerShell's Structure
The basic PowerShell command consists of a two-word sentence. Start with a verb follow with a dash and end with a noun. Naturally,
you press carriage return when you have finished the command.
Get-Process (Correct).
get - process (Wrong. The dash needs no space).
With time and practice, you will soon increase your
vocabulary. Experiment with nouns such as Eventlog. For example: Get-Eventlog -List.
From this example we learn that the dash or minus sign has another role, namely as a modifier or switch, thus
the role of a space, or a lack of a space, becomes more obvious, for example -List tells the command to display all the event logs.
Perhaps the most useful command for beginners is: Get-Help
followed by the command.
For example:
Get-Help process or Get-Help Get-Process or better: Get-Help Get-Process -full
Alternatively, you could try plain: help. From this we deduce that the default verb is 'get'. Test this theory by typing just a noun that PowerShell understands:
Process help eventlog
»
If you like this page then please share it with your friends
Windows Management Instrumentation (WMI) is
most useful for PowerShell scripting.
SolarWinds
have produced this
Free WMI Monitor to take the guess work out of which
WMI counters to use for applications like Microsoft Active Directory,
SQL or Exchange Server.