0
0
PowerShellscripting~20 mins

Command discovery (Get-Command) in PowerShell - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
PowerShell Command Discovery Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
1:30remaining
What is the output of this PowerShell command?
Consider the command:
Get-Command -Name Get-Process

What type of command does this return?
PowerShell
Get-Command -Name Get-Process | Select-Object -ExpandProperty CommandType
ACmdlet
BFunction
CAlias
DApplication
Attempts:
2 left
💡 Hint
Think about what kind of command 'Get-Process' is in PowerShell.
💻 Command Output
intermediate
1:30remaining
What does this command output?
What is the output of:
Get-Command -Verb Get | Select-Object -First 1 -ExpandProperty Name
PowerShell
Get-Command -Verb Get | Select-Object -First 1 -ExpandProperty Name
AGet-Content
BGet-Acl
CGet-Item
DGet-Process
Attempts:
2 left
💡 Hint
The commands are sorted alphabetically by default.
🔧 Debug
advanced
2:00remaining
Why does this command fail?
This command is intended to find all commands with the noun 'Service':
Get-Command -Noun Service*

But it returns an error. Why?
PowerShell
Get-Command -Noun Service*
AThe correct parameter is -Name, not -Noun.
BThe -Noun parameter does not accept wildcards.
CGet-Command does not support filtering by noun.
DThe wildcard should be in quotes: 'Service*'.
Attempts:
2 left
💡 Hint
Think about how PowerShell treats wildcards in parameters.
🧠 Conceptual
advanced
2:00remaining
Which command lists all aliases starting with 'g'?
You want to list all aliases whose names start with the letter 'g'. Which command will do this?
AGet-Command -CommandType Alias | Where-Object Name -like 'g*'
BGet-Alias -Name g*
CGet-Command -CommandType Alias -Name g*
DGet-Command -Alias g*
Attempts:
2 left
💡 Hint
Get-Command can filter by command type and name pattern.
🚀 Application
expert
2:30remaining
How many cmdlets have the noun 'Item'?
Using Get-Command, how many cmdlets have the noun exactly 'Item'?
PowerShell
Get-Command -CommandType Cmdlet -Noun Item | Measure-Object | Select-Object -ExpandProperty Count
A5
B3
C7
D10
Attempts:
2 left
💡 Hint
Use Get-Command with -Noun and count the results.