Challenge - 5 Problems
PowerShell Command Discovery Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate1:30remaining
What is the output of this PowerShell command?
Consider the command:
What type of command does this return?
Get-Command -Name Get-Process
What type of command does this return?
PowerShell
Get-Command -Name Get-Process | Select-Object -ExpandProperty CommandType
Attempts:
2 left
💡 Hint
Think about what kind of command 'Get-Process' is in PowerShell.
✗ Incorrect
The 'Get-Process' command is a built-in cmdlet in PowerShell, so the CommandType property will be 'Cmdlet'.
💻 Command Output
intermediate1: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 NameAttempts:
2 left
💡 Hint
The commands are sorted alphabetically by default.
✗ Incorrect
Get-Command returns commands with the verb 'Get'. The first alphabetically is 'Get-Acl'.
🔧 Debug
advanced2:00remaining
Why does this command fail?
This command is intended to find all commands with the noun 'Service':
But it returns an error. Why?
Get-Command -Noun Service*
But it returns an error. Why?
PowerShell
Get-Command -Noun Service*
Attempts:
2 left
💡 Hint
Think about how PowerShell treats wildcards in parameters.
✗ Incorrect
Wildcards must be passed as strings in quotes. Without quotes, PowerShell treats Service* as a command or variable, causing an error.
🧠 Conceptual
advanced2: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?
Attempts:
2 left
💡 Hint
Get-Command can filter by command type and name pattern.
✗ Incorrect
Get-Command with -CommandType Alias and -Name g* lists aliases starting with 'g'. Get-Alias does not support wildcards in -Name.
🚀 Application
expert2: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
Attempts:
2 left
💡 Hint
Use Get-Command with -Noun and count the results.
✗ Incorrect
There are 5 cmdlets with the noun 'Item' such as Get-Item, New-Item, Remove-Item, etc.