0
0
PowerShellscripting~10 mins

Pipeline object flow in PowerShell - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to send the output of Get-Process to the pipeline.

PowerShell
Get-Process | [1]
Drag options to blanks, or click blank then click option'
ANew-Item
BSort-Object
CGet-Item
DWrite-Host
Attempts:
3 left
💡 Hint
Common Mistakes
Using Write-Host breaks the pipeline by converting objects to text.
Get-Item and New-Item do not accept pipeline input from Get-Process.
2fill in blank
medium

Complete the code to filter processes with CPU usage greater than 100.

PowerShell
Get-Process | Where-Object { $_.CPU [1] 100 }
Drag options to blanks, or click blank then click option'
A<
B-ne
C-eq
D>
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<' filters processes with CPU less than 100, which is opposite.
Using '-eq' or '-ne' checks for equality or inequality, not greater than.
3fill in blank
hard

Fix the error in the pipeline to select the process names only.

PowerShell
Get-Process | Select-Object -Property [1]
Drag options to blanks, or click blank then click option'
AName
BPath
CId
DCPU
Attempts:
3 left
💡 Hint
Common Mistakes
Selecting 'Id' or 'CPU' returns other properties, not the names.
Selecting 'Path' may return null for some processes.
4fill in blank
hard

Fill both blanks to create a pipeline that gets services and filters only running ones.

PowerShell
Get-Service | Where-Object { $_.[1] -eq '[2]' }
Drag options to blanks, or click blank then click option'
AStatus
BName
CStopped
DRunning
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'Name' instead of 'Status' as the property.
Filtering for 'Stopped' instead of 'Running'.
5fill in blank
hard

Fill all three blanks to create a pipeline that gets processes, selects their names and CPU, and filters those with CPU over 50.

PowerShell
Get-Process | Select-Object [1], [2] | Where-Object { $_.[3] -gt 50 }
Drag options to blanks, or click blank then click option'
AName
BCPU
DId
Attempts:
3 left
💡 Hint
Common Mistakes
Selecting 'Id' instead of 'CPU' for filtering.
Filtering on a property not selected in Select-Object.