Windows PowerShell

Windows PowerShell is a task automation and configuration management framework from Microsoft, consisting of a command-line shell and associated scripting language built on the .NET Framework. PowerShell provides full access to COM and WMI, enabling administrators to perform administrative tasks on both local and remote Windows systems as well as WS-Management and CIM enabling management of remote Linux systems and network devices.

In PowerShell, administrative tasks are generally performed by cmdlets which are specialized .NET classes implementing a particular operation. Sets of cmdlets may be combined into scripts, executables (which are standalone applications), or by instantiating regular .NET classes (or WMI/COM Objects). These work by accessing data in different data stores, like the file system or registry, which are made available to the PowerShell runtime via Windows PowerShell providers.

Windows PowerShell also provides a hosting API with which the Windows PowerShell runtime can be embedded inside other applications. These applications can then use Windows PowerShell functionality to implement certain operations, including those exposed via the graphical interface. Different Microsoft applications, for example Microsoft SQL Server 2008 also expose their management interface via PowerShell cmdlets. With PowerShell, graphical interface-based management applications on Windows are layered on top of Windows PowerShell.

Windows PowerShell includes its own extensive, console-based help, similar to man pages in Unix shells, via the Get-Help cmdlet.

Examples:

This example lists all services registered on the machine and prints their current status:

Get-Service | Foreach {$_.name + " Status:-" + $_.status}

This example finds all Windows Log Files with 'Error' inside:

Clear-Host
 $Directory = "C:\Windows\"
 $Phrase = "Error"
 $Files = Get-Childitem $Directory -recurse -Include *.log `
 -ErrorActionSilentlyContinue
 $Files | Select-String $Phrase -ErrorActionSilentlyContinue `
 | Group-Object filename | Sort-Object count –descending

Read more detailed information on PowerShell usage here