PowerShell v3 and Windows Server 2012 – Discoverability

Home > Blogs > PowerShell > PowerShell v3 and Windows Server 2012 – Discoverability

PowerShell v3 and Windows Server 2012 – Discoverability

Like This Blog 0 Jason Helmick
Added by June 22, 2012

PowerShell 2.0 is a nearly perfect management tool for administrators to use to manage their environments. Notice I said nearly perfect?  Let me show you what I mean.

PowerShell 2.0
PowerShell 2.0 was released with a lot of discoverability features. Discoverability meaning, it will help you find what you’re looking for.


PS C:\> get-help

Get-Help is one of my favorite cmdlets of all time because it has discoverability capability built in. In this case, if you know the name of the cmdlet that you need some help on – like Get-Service – It’ll give you the Help for that cmdlet.

PS C:\> get-help get-service

But what if you don’t know the cmdlet you’re looking for? Here’s where the power of Get-Help is really amazing as it supports wildcard characters.

For examplem let's use *service*. Show all of the cmdlets that work with Services:

PS C:\> get-help *service*

Get-Help will search the entire help system (Similar to Bing or Google) to locate just what you need. In this case it will display a list of cmdlets that will let you work with services.

PowerShell get help services cmdlets that work with Services


Get-Help searches the help system.

Once you have the list, look at the synopsis and  find the cmdlet that does what you’re looking for.

You get the idea: search for a cmdlet, then use Get-Help to display the help of the cmdlet – Rinse and Repeat as needed.

PS C:\> get-help stop-service

Windows PowerShell Get Help Stop Service

The problem with Get-Help is PwoerShell V2.0 is that it can only search the help for cmdlets that have been imported into the system. Let’s say you wanted to find the cmdlets that will manage an IIS web server.

PS C:\> get-help *web*

Windows PowerShell Get-Help web

This doesn’t return a list of web administration cmdlets, although it does return a cmdlet, its not the right one


If you’ve been working with PowerShell 2.0 for a while, you know that product-specific cmdlets are put into modules. In order to get to those cmdlets, you must first load those modules.

PS C:\ Import-Module WebAdministration
PS C:\ Get-Help *web*

PS C:\>  get-module
PS C:\>

Notice, I don’t have any modules loaded.
Therefore, we’ll run Get-Module again, and this time, PowerShell will return all of the modules that are currently available if we use ListAvailable:

PS C:\> get-module – ListAvailable

 Windows PowerShell Get-Module ListAvailable





Notice at the bottom there’s WebAdministration module. That’s because we have IIS on this machine. But we don’t have access to discover the cmdlets. First we’ll need to import the module by using Import-Module web*.

PS C:\> import-module web*
PS C:\>

The module’s in now imported and now we can use Get-Help * web * for this module.

PS C:\> get-help *web*

PowerShell now provides all the available cmdlets for *web*.
Windows PowerShell Get-Help web

Don’t forget to import the module first before attempting to use Get-Help discoverability

Here is the problem. You can’t discover product specific cmdlets until you import the module for the product. What if you don’t know the name of the module? What if you have 50, 60, or 80 modules?

This is why you want to install PowerShell V3 on your servers and clients as soon as it releases.

PowerShell Get-Website


Windows PowerShell Get-Website

I think this is one of the greatest feature updates for this release. PowerShell V3 can look at cmdlet names inside of modules regardless if they have been imported or not.

Read that statement again, you DO NOT need to import modules to discover the cmdlets that they contain. And that is a good thing as I think Microsoft is putting in up to 80 new modules in Server 2012.

Here is an example and I’m not going to import the web administration module first,

PS C:\> Get-Help *web*

Take a look at Figure 4 and you will notice Get-Help discovered everything I need.

PowerShell V3 Microsoft Windows Server 2012
We'll start with Get-Help on Service.

PS C:\ get-help *service*

PowerShell v3 returns a list of cmdlets for services, just as you would expect.

PowerShell v3 Windows Server 2012 get-help

Windows Server 2012 comes with more PowerShell modules than previous versions.

modules PowerShell v3 Windows Server 2012


PS C:\> Get-Module -ListAvailable

PowerShell v3 Get-Module ListAvailable Windows Server 2012

This is where the new feature truly takes effect. If this was PowerShell 2.0, you would have to learn and remember what modules you wanted to have loaded, in order to be able to even find the cmdlets you were looking for.

Next let’s type Get-Help to find out what cmdlets are available to manage a website.

PS C:\> get-help *web*

Now in PowerShell 2.0, this would fail but in v3 we get all of the available cmdlets.

PowerShell v3 Get-Help cmndets ListAvailable Windows Server 2012

Additionally, V3 returns not only the list of cmdlets available, but also the module it’s coming from.

PowerShell v3 Get-Help cmndets ListAvailable Windows Server 2012

Using Get-Help no longer requires you to import the module first in PowerShell V3.0

PS C:\> get-help get-website

Not only can I discover the names of the cmdlets, I can get a full help listing of the cmdlets without ever importing the module.

PowerShell v3 Get-Website Windows Server 2012

Using Get-Help without importing the module

Last but certainly not least; you can execute the cmdlet without importing the module. Yup, that’s right boys and girls, the modules will be dynamically loaded.

PowerShell v3 Get-Website Windows Server 2012
The module is dynamically loaded so the cmdlet can execute.

PowerShell v3 Get-module Windows Server 2012

This means that admins don’t have to go around memorizing modules, remembering to import everything before they use Get-Help. In other words, just use the discoverability feature, find the cmdlet you’re looking for, and use the cmdlet. PowerShell will take care of everything for you in the background.
Pretty cool, huh?

Knowledge is PowerShell.
Jason Helmick
Jason Helmick
Director of PowerShell Technologies
Interface Technical Training

Videos You May Like

JavaScript for C# Developers – September 24, 2014

0 487 3

Is JavaScript worth taking the time to learn if I’m a server-side .NET developer? How much of C# carries over to JavaScript? In this recorded video from Dan Wahlin’s webinar on September 24,2014, Dan answers these questions and more while also discussing similarities between the languages, key differences, and the future of JavaScript (ES6). If … Continue reading JavaScript for C# Developers – September 24, 2014

How to clone a Windows Server 2012 or 2012 R2 Domain Controller

3 1486 3

One of the coolest new features in Window Server 2012 and Windows Server 2012 R2 is the ability to clone a Domain Controller. In the past, if we had virtualized Domain Controllers and we actually took a snapshot of it and then rolled back to that snapshot, it would break the logon service on that … Continue reading How to clone a Windows Server 2012 or 2012 R2 Domain Controller

Detailed Forensic Investigation of Malware Infections – April 21, 2015

4 609 5

How does an investigator hunt down and identify unknown malware? In this recording of our IT Security training webinar on April 21, 2015, Security expert Mike Danseglio (CISSP / CEH) performed several malware investigations on infected computers and identify symptoms, find root cause, and follow the leads to determine what’s happening. He demonstrated his preferred … Continue reading Detailed Forensic Investigation of Malware Infections – April 21, 2015

Write a Comment

Share your thoughts...

Please fill out the comment form below to post a reply.