Bird
0
0

Which of the following is the correct way to display the PowerShell version using $PSVersionTable?

easy📝 Syntax Q12 of 15
PowerShell - Variables and Data Types
Which of the following is the correct way to display the PowerShell version using $PSVersionTable?
AWrite-Output $PSVersionTable.VersionInfo
BWrite-Output $_.Version
CWrite-Output $PSVersion.VersionTable
DWrite-Output $PSVersionTable.Version
Step-by-Step Solution
Solution:
  1. Step 1: Identify the correct property of $PSVersionTable

    The property Version holds the PowerShell version number.
  2. Step 2: Confirm the syntax to output the version

    Write-Output $PSVersionTable.Version correctly prints the version; other options use wrong variable names or properties.
  3. Final Answer:

    Write-Output $PSVersionTable.Version -> Option D
  4. Quick Check:

    $PSVersionTable.Version outputs version [OK]
Quick Trick: Use $PSVersionTable.Version to get PowerShell version [OK]
Common Mistakes:
  • Using $_ instead of $PSVersionTable
  • Swapping property names incorrectly
  • Assuming $PSVersionTable is a method

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes