Tech moves fast! Stay ahead of the curve with Techopedia!
Join nearly 200,000 subscribers who receive actionable tech insights from Techopedia.
PowerShell is an automated task framework from Microsoft, with a command line shell and a scripting language integrated into the .NET framework, which can be embedded within other applications. It automates batch processing and creates system management tools. It includes more than 130 standard command line tools for functions and enables administrators to perform tasks on local and remote Windows systems through access to Component Object Model (COM) and Windows Management Instrumentation (WMI).
Windows PowerShell executes four types of commands:
PowerShell automates tasks using cmdlets. These are .NET application programming interface (API) classes appearing as system commands and implementing specific functions. They are the native commands in PowerShell and process objects individually. They are used as recipients in a pipeline and receive and output results as objects. Cmdlets on each object in a collection are invoked in a sequence by PowerShell. They are derived from the Cmdlet or PsCmdlet base classes. When a cmdlet runs, the methods ProcessRecord(), BeginProcessing() and EndProcessing() are invoked. The class implementing cmdlet holds one .NET attribute and the Cmdlet attribute, which specifies the name of the cmdlet. Cmdlets use .NET data access APIs directly or may use the power shell infrastructure to make the data store available using specific paths.
PowerShell has an interactive command line interface. PowerShell allows the user to produce aliases for cmdlets, which are converted to the original commands by PowerShell.
Pipeline is an important concept included in PowerShell. The output of a command is passed over to another command using a | operator. Unlike Unix pipelining, the commands passed are typed objects with a consistent interface, which retain their structure during the process and do not require additional parsing. These objects encapsulate functions working on contained data. The output object of the last cmdlet is pipelined to an Out-Default cmdlet, which converts the object into a stream of format objects and renders them on the screen.
Microsoft has released PowerShell 2, which is installed by default on Windows 7 and Windows Server 2008 R2. PowerShell V2 includes about 240 cmdlets and includes changes in scripting language and the hosting API. New features added in PowerShell V2 are: