Professional Documents
Culture Documents
Core Windows Powershell® Cmdlets
Core Windows Powershell® Cmdlets
Core Windows
PowerShell Cmdlets
Module Overview
In this module, you will learn to:
Recognize Windows PowerShells core cmdlets
Sort, group, count, measure, and select objects in the
pipeline
Sort-Object
Group-Object
Measure-Object
Select-Object
Compare-Object
Import-CSV
Export-CSV
Import-CliXML
Export-CliXML
Is a general software term that typically refers to some selfcontained piece of functionality
A PowerShell cmdlet
For example,
Object -> Cmdlet -> Object
The Event Log -> Get-EventLog -> An Event Log View
Sorting Objects
The Sort-Object cmdlet
Grouping Objects
The Group-Object cmdlet
Measuring Objects
The Measure-Object cmdlet
-average
-maximum
-minimum
-sum
Selecting Objects
The Select-Object cmdlet
sources
Comparing Objects
The Compare-Object cmdlet
a File
Logon information
Virtual machine
LON-DC1
LON-SVR1
Password
Pa$$w0rd
Pa$$w0rd
LON-SVR2
Pa$$w0rd
Lab Scenario
You work as a system administrator in a small company
The company you work with has not invested in an
Lab Review
How might sorting work with numbers versus strings?
Can you think of other delimiters you may want to use
with Export-Csv?
criteria
Boolean Operators
The Boolean operators (-and, -or, -not) are used in more-
execution
Logon information
Virtual machine
LON-DC1
LON-SVR1
Password
Pa$$w0rd
Pa$$w0rd
LON-SVR2
Pa$$w0rd
Lab Scenario
You are a system administrator
One of your tasks in the morning as your shift is starting is
Lab Review
What if you wanted to filter a list of processes that started
remote computer?
ByPropertyName
of input
Positional Parameters
Positional parameters do not require specifying their name
-InputObject <psobject>
Specifies the objects to be filtered. You can
Required?
Position?
Default value
Accept pipeline input?
Accept wildcard characters?
false
named
true (ByValue)
False
false
named
Localhost
true (ByPropertyName)
False
Renaming Properties
Sometimes you need to bind cmdlets, but those cmdlets
Select-Object
@{Label=NewName;Expression={$_.OldName}}
Get-ADComputer filter * | Select-Object
@{Label="ComputerName";Expression={$_.Name}}
Get-ADComputer filter * | Select-Object *,
@{Label="ComputerName";Expression={$_.Name}} |
Get-Service
Understanding Passthrough
Some action cmdlets accept pipeline input, but do not
provide output.
Logon information
Virtual machine
LON-DC1
LON-SVR1
Password
Pa$$w0rd
Pa$$w0rd
LON-SVR2
Pa$$w0rd
Lab Scenario
You are a system administrator for a company with about
Lab Review
Do all cmdlets accept pipeline input like New-ADUser?
What is the advantage of a cmdlet parameter that accepts
pipeline input?
the pipeline?
Class Discussion
Common issues related to core cmdlets
Best practices related to core cmdlets