0
0
PowerShellscripting~10 mins

Why PowerShell automates admin tasks - Test Your Understanding

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

Complete the code to list all running processes.

PowerShell
Get-Process | Where-Object { $_.CPU -gt [1] }
Drag options to blanks, or click blank then click option'
Anull
B100
C-1
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Using -1 is invalid as CPU time cannot be negative; 100 excludes low-CPU ones; null causes errors.
2fill in blank
medium

Complete the code to stop a service named 'Spooler'.

PowerShell
Stop-Service -Name [1]
Drag options to blanks, or click blank then click option'
AServiceSpool
BSpooler
CPrinter
DPrintSpooler
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect or partial service names causes errors.
3fill in blank
hard

Complete the code to get the current date and time.

PowerShell
$now = Get-Date[1]
Drag options to blanks, or click blank then click option'
A{}
B[]
C()
D<>
Attempts:
3 left
💡 Hint
Common Mistakes
Using [] {} or <> causes syntax errors.
4fill in blank
hard

Fill both blanks to filter services that are running and display their names.

PowerShell
Get-Service | Where-Object { $_.Status -eq [1] } | Select-Object [2]
Drag options to blanks, or click blank then click option'
A'Running'
B'Stopped'
CName
DStatus
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong status or selecting wrong properties shows incorrect results.
5fill in blank
hard

Fill both blanks to create a hashtable of process names and their IDs for processes using more than 50 CPU seconds.

PowerShell
$processes = @{}; Get-Process | Where-Object { $_.CPU -gt 50 } | ForEach-Object { $processes[[1]] = [2] }
Drag options to blanks, or click blank then click option'
A$_.ProcessName
B$_.Id
Cprocess
Dproc
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong variable names or properties causes errors or empty results.