Bird
0
0

Which of the following is the correct way to execute a script block on a remote computer named 'Server01' using Invoke-Command?

easy📝 Syntax Q3 of 15
PowerShell - Remote Management
Which of the following is the correct way to execute a script block on a remote computer named 'Server01' using Invoke-Command?
AInvoke-Command -ComputerName Server01 -ScriptBlock { Get-Process }
BInvoke-Command -Session Server01 -ScriptBlock { Get-Process }
CInvoke-Command -Computer Server01 -Command { Get-Process }
DInvoke-Command -RemoteName Server01 -ScriptBlock { Get-Process }
Step-by-Step Solution
Solution:
  1. Step 1: Identify correct parameter for remote computer

    The parameter to specify the remote computer is -ComputerName.
  2. Step 2: Confirm script block syntax

    The script block must be enclosed in curly braces and passed to -ScriptBlock.
  3. Step 3: Evaluate other options

    -Session requires a PSSession object, -Computer and -RemoteName are invalid parameters.
  4. Final Answer:

    Invoke-Command -ComputerName Server01 -ScriptBlock { Get-Process } -> Option A
  5. Quick Check:

    Use -ComputerName and -ScriptBlock for remote commands [OK]
Quick Trick: Use -ComputerName and -ScriptBlock for remote commands [OK]
Common Mistakes:
  • Using invalid parameters like -Computer or -RemoteName
  • Passing script block without braces
  • Confusing -Session with -ComputerName

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes