PowerShell 5.0, the major component in the Windows Management Framework 5.0 suite, contains several updates and two new major features, including OneGet.

Joseph Moody

Joseph Moody is a network admin for a public school system and helps manage 5,500 PCs. He is a Microsoft Most Valuable Professional (MVP) in Cloud and Datacenter Management and blogs at DeployHappiness.com.

It has been six months since the release of Windows Management Framework (WMF) 4.0. The core component in WMF 4.0 is version 4.0 of PowerShell. The PowerShell team has been hard at work on the latest revision and has publically released the WMF 5.0 Preview. But what’s new in PowerShell 5.0?

Checking the installed PowerShell version

The two biggest features in PowerShell 5.0 are Windows PowerShell OneGet and a new module for managing layer 2 network switches. Smaller features include updates for Desired State Configuration (DSC), the PowerShell console, and the Integrated Scripting Environment (ISE).

As we cover these additions, you can follow along by installing the WMF 5.0 update on your machine. The update can be downloaded here. As of right now, PowerShell 5.0 can only be used on Windows 8.1 and Server 2012 R2 machines. Because it is a preview, it should not be used in a production environment, and it may come with specific server install conditions. For example, it is currently not supported on SCCM 2012, SCVMM 2008 R2, and Exchange 2007.

What is Windows PowerShell OneGet? ^

OneGet is the PowerShell team’s answer to the complexity of application installation. By using the Chocolately repository, applications can be installed, updated, or removed with command line precision. Let’s start by viewing the commands in the OneGet module:

The first version of OneGet contains seven new cmdlets.

By quickly reading the help file for each module, we can see that Find-Package will display available applications for installation. In fact, more than 1,800 packages are available. We can take find-package to Out-GridView to search the software content. In this example, we are going to search for the latest version of 7-Zip.

Filtering in Out-Gridview makes finding applications super easy!

Filtering in Out-GridView makes finding applications super easy!

If we wanted to install 7-Zip 9.22 on our machine, we could use basic PowerShell syntax to find our application and install it. Here is an example:

One line can install an application in PowerShell.

OneGet can potentially let you automate complex application installations, simplify network shares, and make reinstallation much easier. Imagine creating a OneGet script that installs all of your favorite applications automatically, and in just a few minutes! Imagine being able to uninstall an application with a simple PowerShell command. That is the power of OneGet.

Managing network switches with PowerShell ^

Windows Server 2012 R2 introduced native management of layer 2 network switches. When you have Windows Server certified equipment, you can use SCVMM 2012 R2 to manage the hardware. There are times when you might need to manage equipment with a PowerShell script. WMF 5.0 introduces that ability.

The new module, Network Switch, contains 19 cmdlets that allow you to do the following in a CIM session:

  • Investigate the switch and available features with the Get-NetworkSwitchFeature cmdlet.
  • Configure specific switch features or enable/disable switch features.
  • Manage VLANs with the NetworkSwitchVLAN cmdlet set (Get, New, Disable, Enable, Remove, Set).
  • Save or restore switch configurations.

Though this module isn’t widely available for use yet, Microsoft has documented a few ways in which it can be used. If you have compatible hardware, you can use the following commands to establish a session:

With the session, you can begin using the Network Switch modules. For example, Get-NetworkSwitchFeature -CimSession $Session would list any available features. Disabling a port is a simple command: Disable-NetworkSwitchEthernetPort -PortNumber 1 -CimSession $Session.

OneGet and network switch management make PowerShell even better! Expect to see each be improved and blogged about over the next few months. Have you used PowerShell 5.0 yet? What features are the most exciting for you?

Join the 4sysops PowerShell group!

1+
Share
0 Comments

Leave a reply

Your email address will not be published. Required fields are marked *

*

© 4sysops 2006 - 2019

CONTACT US

Please ask IT administration questions in the forums. Any other messages are welcome.

Sending

Log in with your credentials

or    

Forgot your details?

Create Account