Monthly Archive

Categories

PowerShell 3 discovery

Having a quick look at the numbers of commands in PowerShell 3 on Windows 8 I get this

 

PS> (get-command -CommandType cmdlet).count
376
PS> (get-command -CommandType function).count
524

 

The numbers are even higher on Server 8 depending on what  features/roles you have loaded.

 

How do you keep track of all those commands – memorising 900 names is not going to happen never mind the reported 2000+ on the server.

The answer is to step up a level to the module. Remember the modules that are available or use

PS> Get-Module -ListAvailable

    Directory: C:\Scripts\Modules

ModuleType Name                      ExportedCommands
---------- ----                      ----------------
Manifest   SystemInfo                {Get-ComputerSystem, Get-OperatingSystem}

    Directory: C:\Windows\system32\WindowsPowerShell\v1.0\Modules

ModuleType Name                      ExportedCommands
---------- ----                      ----------------
Manifest   AppLocker                 {Set-AppLockerPolicy, Get-AppLockerPolicy, Test-AppLockerPolicy...
Manifest   Appx                      {Add-AppxPackage, Get-AppxPackageManifest, Get-AppxPackage...
Manifest   BitLocker                 {Get-EncryptableVolume, Get-EncryptableVolumes, Get-Protectors..
Manifest   BitsTransfer              {Add-BitsFile, Remove-BitsTransfer, Complete-BitsTransfer...
Manifest   BranchCache               {Add-BCDataCacheExtension, Clear-BCCache, Disable-BC...

 

Notice that the folder the module is contained is displayed – useful.

Alternatively refine the search

Get-Module -ListAvailable *dns*

One point to note is that Get-Module by default only shows the modules you’ve used!  A new PowerShell console shows

Microsoft.PowerShell.Core
Microsoft.PowerShell.Management

but

PS> get-module | select name

Name
----
Microsoft.PowerShell.Core
Microsoft.PowerShell.Management
Microsoft.PowerShell.Utility

because we’ve used select-object

Leave a Reply