0
0
PowerShellscripting~10 mins

Pipeline concept (|) 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 list all files and then show only their names.

PowerShell
Get-ChildItem [1] Select-Object Name
Drag options to blanks, or click blank then click option'
A-Filter
B|
C-Path
D-Name
Attempts:
3 left
💡 Hint
Common Mistakes
Using a parameter like -Filter instead of the pipeline symbol.
Using a dash '-' instead of the pipe '|'.
2fill in blank
medium

Complete the code to get all running processes and sort them by CPU usage.

PowerShell
Get-Process [1] Sort-Object CPU -Descending
Drag options to blanks, or click blank then click option'
A-ProcessName
B-Name
C-CPU
D|
Attempts:
3 left
💡 Hint
Common Mistakes
Trying to use a parameter instead of the pipeline.
Using a comma or semicolon instead of '|'.
3fill in blank
hard

Fix the error in the code to filter services that are running.

PowerShell
Get-Service [1] Where-Object {$_.Status -eq 'Running'}
Drag options to blanks, or click blank then click option'
A|
B-Filter
C-Name
D-Status
Attempts:
3 left
💡 Hint
Common Mistakes
Using a parameter like -Filter instead of the pipeline.
Missing the pipeline symbol causes a syntax error.
4fill in blank
hard

Fill both blanks to get all services, filter running ones, and select their names.

PowerShell
Get-Service [1] Where-Object {$_.Status -eq 'Running'} [2] Select-Object Name
Drag options to blanks, or click blank then click option'
A|
B-Name
D-Status
Attempts:
3 left
💡 Hint
Common Mistakes
Using parameters instead of pipelines between commands.
Missing one or both pipeline symbols.
5fill in blank
hard

Fill all three blanks to get processes, filter by CPU > 100, and select their names.

PowerShell
Get-Process [1] Where-Object {$_.CPU [2] 100} [3] Select-Object Name
Drag options to blanks, or click blank then click option'
A|
B-gt
D-CPU
Attempts:
3 left
💡 Hint
Common Mistakes
Using parameters instead of pipelines.
Using '=' instead of '-gt' for comparison.
Missing one of the pipeline symbols.