Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to run a command on a remote computer named 'Server01'.
PowerShell
Invoke-Command -ComputerName [1] -ScriptBlock { Get-Process } Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using the local computer name instead of the remote computer name.
Leaving the -ComputerName parameter empty.
✗ Incorrect
The -ComputerName parameter specifies the remote computer to run the command on. 'Server01' is the correct remote computer name.
2fill in blank
mediumComplete the code to run the command 'Get-Service' on the remote computer 'Server02'.
PowerShell
Invoke-Command -ComputerName Server02 -ScriptBlock { [1] } Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a command unrelated to services.
Forgetting to put the command inside the script block.
✗ Incorrect
The script block should contain the command you want to run remotely. 'Get-Service' lists services on the remote computer.
3fill in blank
hardFix the error in the code to correctly run 'Get-EventLog' on 'Server03'.
PowerShell
Invoke-Command -ComputerName Server03 -ScriptBlock [1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Not using curly braces for the script block.
Using parentheses or square brackets instead of curly braces.
✗ Incorrect
The script block must be enclosed in curly braces {} to run commands remotely.
4fill in blank
hardFill both blanks to run 'Get-Process' on 'Server04' and store the result in a variable.
PowerShell
$processes = Invoke-Command -ComputerName [1] -ScriptBlock [2]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up computer names.
Not using curly braces for the script block.
✗ Incorrect
The -ComputerName should be 'Server04' and the script block should contain '{ Get-Process }' to run the command remotely.
5fill in blank
hardFill all three blanks to run 'Get-Service' on 'Server06' and filter services with status 'Running'.
PowerShell
$runningServices = Invoke-Command -ComputerName [1] -ScriptBlock { Get-Service | Where-Object { $_.Status -eq '[2]' } } | Where-Object { $_.Name -like '[3]' }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong computer name.
Using wrong status like 'Stopped' instead of 'Running'.
Not using wildcard '*' for name filter.
✗ Incorrect
The command runs on 'Server06', filters services with status 'Running', and then filters names matching any pattern with '*'.