PowerShell is a powerful scripting tool that you can use to automate system administration and application management tasks from the command-line. Using PowerShell, you can create scripts to manage the Windows operating system and applications that run on Windows. PowerShell commands enable you to perform certain tasks, especially those involving a number of objects, much faster than the graphical user interface (GUI). Some tasks can only be done through PowerShell.
The following terms are used with PowerShell:
Term | Definition |
Command line | The command line refers to the command-line interface (CLI) used to interact with a computer program. Commands are entered at the command prompt. The command-line interface:
|
Cmdlets | Cmdlets are commands that an administrator enters at the PowerShell prompt to perform system management tasks. The PowerShell command-line interface uses simple command construction, typically in the form of:
When using PowerShell cmdlets, keep in mind the following:
|
Providers | Windows PowerShell providers allow you to access data stores, such as the registry and certificate store, in a way similar to accessing the file system. |
Some new features in Windows PowerShell 3.0 included with Windows Server 2012 are:
- The Deployment Image Servicing and Management (DISM) module Get-WindowsOptionalFeature -Online cmdlet allows an administrator to view features installed on a remote computer. Administrators can then add or remove cmdlets from the remote computer using the Add-WindowsFeature and Remove-WindowsFeature cmdlets.
- Remote Windows PowerShell connections have been improved to attempt to maintain a connection even when network connectivity is lost. Previous versions of PowerShell easily dropped the remote connection when network connectivity problems were encountered. PowerShell 3.0 allows you to reconnect from a different computer if the connection is lost.
- Windows PowerShell Workflows are sequences of multicomputer management activities. Windows PowerShell Workflows allow workflows written in XAML or the PowerShell scripting language to be run as a cmdlet.
Windows Server 2012 R2 introduces PowerShell Desired State Configuration (DSC) which allows administrators to manage the configuration and environment of computers and devices connected through a cloud infrastructure. With DSC, the administrator uses declarative scripting to specify and manage configuration. DSC resources include the following:
- Management Object Format (MOF) files are used to specify management tasks to be performed. Administrators can create MOF files in a variety of ways, including PowerShell v4 declarative syntax extensions or third-party tools. PowerShell v4 has built-in resources to facilitate MOF creation. These resources include:
- WindowsFeature identifies the role, such as Web server.
- File identifies and manages files and directories.
- Group identifies and manages local Windows groups.
- PowerShell keyword configuration is used to create MOF files.
- The creation of custom resources using PowerShell v4 or third-party tools is supported.
- DSC Local Configuration Manager runs on all target nodes and calls the necessary configuration resources.
- The option to use a push or pull implementation.
- In the Pull Model, DSC data and custom providers are kept on an IIS Web server. The target contacts the IIS Web server to obtain the configuration instructions.
- In the Push Model, the configuration instructions and custom providers are pushed to the target system.