Bird
0
0

What is the output of this PowerShell command?

medium📝 Command Output Q13 of 15
PowerShell - Remote Management
What is the output of this PowerShell command?
Invoke-Command -ComputerName Server01,Server02 -ScriptBlock { Get-Date }
AAn error saying Server01 and Server02 are invalid
BNo output because ScriptBlock is empty
CThe local computer's date and time only
DThe current date and time from Server01 and Server02
Step-by-Step Solution
Solution:
  1. Step 1: Understand Invoke-Command with multiple computers

    The command runs the script block on both Server01 and Server02 remotely.
  2. Step 2: Analyze the script block

    The script block calls Get-Date, which returns the current date and time on each remote server.
  3. Final Answer:

    The current date and time from Server01 and Server02 -> Option D
  4. Quick Check:

    Invoke-Command with Get-Date = remote dates [OK]
Quick Trick: Invoke-Command runs script on all listed computers [OK]
Common Mistakes:
  • Expecting local date/time only
  • Thinking ScriptBlock is ignored
  • Assuming invalid computer names cause error

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes