In the past, managing a Windows server environment involved using a series of mmc snap-ins for everything, from managing users and groups, to administrating network services. Windows Server 2008 R2 provided the first opportunity for users to utilize a new way of administration. This update would change the face of server administration for years to come and is known as PowerShell.

What is PowerShell?

Windows PowerShell is a task automation and configuration management framework from Microsoft, consisting of a command-line shell and the associated scripting language built on the .NET framework. PowerShell provides full access to COM and WMI in Windows, providing administrators the ability to perform administrative tasks at scale on both local and remote systems. PowerShell allows you to build interactive scripts to simplify administration, configuration, and management of your windows systems and environments.

Now that you have PowerShell open, where do you start?
That is a great question. The first command display below is to see what version of PowerShell you are currently using? Type into the CLI: $PSVersionTable

This command is useful because it will help you in determining which features, cmdlets, etc. are available with the version of PowerShell you have available.

Getting Started with PowerShell

The most important point to remember when using a program, especially from a CLI, is to learn how to use the help system. Even the experts don’t always know the answers, but they know how to figure them out. When a little bit of help is needed, the help system within the PowerShell environment is beneficial.

The first command we will be exploring is Get-Help:

By using get-help, it will expose the documentation to explore how to use a cmdlet in PowerShell. Some of the parameters you may add to dig down into the details are listed below:
Get-Help Get-Service -examples
Get-Help Get-Service -detailed
Get-Help Get-Service -full

Beginning with PowerShell version 3, the program didn’t automatically download the help feature, so you might have to run an additional cmdlet: Update-Help to get the most current information about cmdlets being used in PowerShell today. Another very popular command to learn when you begin using PowerShell is Get-Command. It is used to help you locate various commands to use when managing windows systems. A cmdlet always consists of a verb and a noun, separated with a hyphen. Here are some examples of the verbs used to help in learning PowerShell:

  • Get — To get something
  • Start — To run something
  • Out — To output something
  • Stop — To stop something that is running
  • Set — To define something
  • New — To create something

Notice in this example where Get-Command was run, the Verb parameter is being issued, and you can see how many cmdlets in this version of PowerShell start with the Get and Set Verbs, two of the most popular ways to manage objects using PowerShell.

Finally, once you find a cmdlet you are interested in using, you can start to extract some useful information from Windows systems. In this example, you can extract the latest entries from the Windows System Log and export them to a file for log analysis.

PowerShell Benefits for Server Administration

The use of PowerShell is extremely valuable to administering your windows and cloud environments. Some of the many benefits of utilizing PowerShell for automation are listed below:

  • Make automating multiple tasks simple
  • Used for managing all Microsoft Products
  • You can’t do everything from the GUI
  • It is stable and foundational to managing Microsoft infrastructure
  • More efficient and even more scalable than using the GUI

It allows you to perform tasks that would otherwise require multiple clicks to manage, even those inside of the GUI. It can also be extremely valuable in troubleshooting and supporting Windows systems, such as tracking down processes that are taking up too many resources on the system.

Final Closing Thoughts

There are so many great features and benefits to learning and utilizing Windows PowerShell as a script language, it’s hard to pick my favorite. You can import from a file a large batch of users or systems for administration, or parse through a large log file to find some useful information, either for troubleshooting or supporting windows systems. Once you start to master some of the basics of the PowerShell syntax, working with scripts and automating configuration of systems becomes a breeze. I leave you with one of my favorites to help you along in your PowerShell journey. If you run this command in PowerShell, you can learn something new every day to help you along in your journey to becoming a PowerShell expert.

Get-Random –input (Get-Help about*) | Get-Help -ShowWindow

How do you think you could use something like scripting to help in your day-to-day activities as a systems administrator? PowerShell allows you to build interactive scripts to simplify administration, configuration, and management of your windows systems and environments. See the options for PowerShell classes on our course page.
Contact Training Concepts for more information on PowerShell and other IT Certification courses to improve your skills.

We can help you redeem your Microsoft’s Software Assurance Training Vouchers.