PowerShell Litmus Test

PowerShell Cmdlet Litmus Test

Amateurs: Use Get-Help to get an overview of what a cmdlet does.
Professionals: Scrutinize Get-Help's information studying a parameter's attributes.

Example of Get-Help's Syntax

Here we employ Get-Eventlog to discover more about Get-Help.

# Needs a LogName

Cmdlet Get-EventLog at command pipeline position 1
Supply values for the following parameters:

The problem, Get-Eventlog is asking us for an input (LogName).  Suppose we don't know the precise logname?  Let us call for:

# Cmdlet help with examples
Get-Help Get-Eventlog -full

Get-EventLog [-LogName] <String> [[-InstanceId] <Int64[]>] ….

— But Get-Eventlog also has a second usage —

Get-EventLog [-AsString [<SwitchParameter>]] [-ComputerName <String[]>] [-List [<SwitchParameter>]] [<CommonParameters>]

Note: Get-EventLog requires -LogName parameter.

Note: Get-EventLog also reveals the names of the logs thanks to the -List parameter thus:

# Display available logs
Get-Eventlog -List

Solarwinds Config GeneratorGuy Recommends: The Free Config Generator

SolarWinds’ Config Generator is a free tool, which puts you in charge of controlling changes to network routers and other SNMP devices.  Boost your network performance by activating network device features you’ve already paid for.

Guy says that for newbies the biggest benefit of this free tool is that it will provide the impetus for you to learn more about configuring the SNMP service with its ‘Traps’ and ‘Communities’. Try Config Generator now – it’s free!

Download your free copy of Config Generator

PowerShell's Parameters Windows PowerShell Get-Help

You mainly request help to check the names of the parameters, but it only takes a quick glance to discover a parameter's attributes.

Get-Help Get-Eventlog.
This example shows parameters with their attributes.

-After <DateTime> At first glance you probably overlooked the <Type> definition in brackets, but now in future you will absorb this extra information.

In this example, knowing that -After expects <DateTime> will alert you to researching the format, especially if you get an error.  Get-Date may give you clues whether to use dd/mm/yy or mm/dd/yy.

ComputerName <String[]> Clearly this indicates a parameter that accepts names such as BigServer, subtly, the square brackets tells you that you could type multiple names separated by commas. -ComputerName [BigServer, LittleServer]

List [<SwitchParameter>]  This is a tricky 'Type' to understand at first.  At it's simplest <SwitchParameter> means the value for this parameter is 'false', unless you explicitly set a value.

Newest <Int32> Means a number!

See more on PowerShell's Parameters

Summary of PowerShell's Get-Help

I would like to move forward from merely using Get-Help, to gaining an understanding of the range of a cmdlets abilities.   Get-Help Verb-Noun can teach you about the principles behind PowerShell, for example, pipelining, nature and capability of objects. 

Download my Jumbo Litmus Test eBook $5.95

Litmus TestsOver 40 of Guy’s litmus tests.  Have fun while you learn about aspects of computing.  Stacks of ideas to check your servers, networks and security.

Your eBook has printer friendly pages and lots more screen shots.


If you like this page then please share it with your friends


See more Microsoft PowerShell tutorials

PowerShell Tutorials  • Methods  • Cmdlets  • PS Snapin  • Profile.ps1  • Exchange 2007

Command & Expression Mode  • PowerShell pipeline (|)  • PowerShell ‘where‘  • PowerShell ‘Sort’

Windows PowerShell Modules  • Import-Module  • PowerShell Module Directory 

If you see an error of any kind, do let me know.  Please report any factual mistakes, grammatical errors or broken links.