Windows PowerShell

Windows PowerShell for IT administrators

Windows PowerShell is a task-based command-line shell and scripting language designed especially for system administration. Built on the .NET Framework, Windows PowerShell helps IT professionals and power users control and automate the administration of the Windows operating system and applications that run on Windows.

PowerShell is capable of automating management tasks and functioning as a dedicated scripting language for Microsoft-based software. Also, PowerShell includes commands called cmdlets that add functionality to the core foundation.

The differentiator between PowerShell and other scripting tools is that it’s object-oriented and built atop Microsoft’s .NET framework. That means PowerShell scripts aren’t just piping around plain ASCII text. Instead, they’re actually scripting entire .NET objects, including all properties and methods.

Microsoft announced that PowerShell was going open source and provided its source code to the public, adding support to Unix-based OSes, including Linux distros and OS X.  With the release of PowerShell 6.0, Microsoft has officially made PowerShell open source, providing access to Linux and Unix-based operating systems, such as Apple macOS. While currently under development, alpha versions of this latest version of PowerShell are available for download from Microsoft’s GitHub repository.

Why PowerShell

Until the release of Windows 95, Microsoft chose to run Windows over DOS since it was the de facto OS in use on IBM-compatible computers. From Windows 95 on, Windows kept MS-DOS since some legacy applications still relied upon it.

Microsoft created PowerShell as a management framework that combines both a command-line shell and scripting language that is built upon the .NET framework that used as a software framework, primarily on Windows, to standardize code and develop powerful applications.

This results in PowerShell being able to not only be used to manage hardware, software, and network objects at the command line, but also allows programmers to use its scripting capabilities to interface with any manageable attributes to share data between them—even outputting this code through .NET to develop applications for one personal computer or scale it to large enterprise systems worldwide.

PowerShell features

  • Cmdlets for performing common system administration tasks, such as managing the registry, services, processes, and event logs, and using Windows Management Instrumentation (WMI).
  • A task-based scripting language and support for existing scripts and command-line tools.
  • Consistent design. Because cmdlets and system data stores use common syntax and naming conventions, data can be shared easily and the output from one cmdlet can be used as the input to another cmdlet without reformatting or manipulation.
  • Simplified, command-based navigation of the operating system, which lets users navigate the registry and other data stores by using the same techniques that they use to navigate the file system.
  • Powerful object manipulation capabilities. Objects can be directly manipulated or sent to other tools or databases.
  • Extensible interface. Independent software vendors and enterprise developers can build custom tools and utilities to administer their software.

Some of the most notable features, modules, and cmdlets include the following

  • Active Directory (module): This module is used by PowerShell to extend management capabilities to Active Directory objects, including computers, users, and groups and attributes stored within accounts.
  • Exchange Server (module): This module is used by PowerShell to enable full administration of Exchange Servers. Included within the module are additional cmdlets that fully support all aspects of your Exchange email server.
  • Get-Help (cmdlet): This built-in cmdlet within PowerShell core provides helpful information, including syntax use and examples of commands and what they accomplish.
  • Get-Command (cmdlet): When executed, this built-in cmdlet within PowerShell core provides a list of commands that are available. It’s useful in identifying which commands are available for each module.
  • Set-Variable (cmdlet): This built-in cmdlet within PowerShell allows the user to create variables used to store data, such as file paths, multiple objects, or snippets of code you wish to reuse.
  • Invoke-Command (cmdlet): This built-in cmdlet within PowerShell calls upon another cmdlet, usually run from a local computer, to execute the invoked command on remote computers.
  • Pipeline ( | ): One of the features of PowerShell is the ability to chain commands together by means of the pipe character. Piping commands causes PowerShell to run the first part of the command and then output the results for use by the second command and so on until the entire sequence is run. It is useful when performing a multiple-step task, such as creating a username, adding the username to a security group, and resetting the default password.
  • Function ( { } ): Similar to the pipeline feature in that cmdlets may be linked together, functions allow for greater control over the scripting process. By wrapping cmdlets in braces, a function is created that serves to run the sequence one or more times.
  • Out-File (cmdlet): This built-in cmdlet within PowerShell allows a command’s output to be exported to a file. Typically used with the pipe feature, a user can get a list of user accounts that are disabled in Active Directory, for example, and export that list to a text file for future use.
  • Import-Module (cmdlet): This built-in cmdlet within PowerShell imports one or more modules into PowerShell to further its feature set, cmdlets, and functionality.

Related Resources

Resources for Windows PowerShell users

Windows PowerShell Team Blog. The best resource for learning directly from the Windows PowerShell product team.

Windows PowerShell Customer Connection. Make a suggestion, send feedback, or file a bug for the Windows PowerShell team. You can file a code bug, a documentation bug, or a localization (language translation) bug.

The Hey, Scripting Guy! Blog publishes new content seven days a week, and is consistently ranked in the top five of all Microsoft blogs. The articles are scenario-driven, and written in an engaging and lively manner.

The Learn PowerShell page is the Windows PowerShell hub on the TechNet Script Center. This page hosts a series of beginner video sessions conducted by the Microsoft Scripting Guy Ed Wilson. It also contains Windows PowerShell quizzes, links to community content, and more.

About Prasad Paul 51 Articles
Prasad Paul is a Technical Writer, Security Blogger, Network Engineer and IT Analyst. He is a Technology Enthusiast with a keen eye on the Cyberspace and other tech related developments.

Be the first to comment

Leave a Reply

Your email address will not be published.


*


*