PowerShell - Basics and EnvironmentWhich of the following is the correct syntax to check the PowerShell version in both 5.1 and 7+?A$PSVersionTable.PSVersion.MajorBGet-PSVersionCversion.psDCheck-PowerShellVersionCheck Answer
Step-by-Step SolutionSolution:Step 1: Identify the standard variable for version info$PSVersionTable is a built-in variable holding version details in all PowerShell versions.Step 2: Access the major version propertyUsing $PSVersionTable.PSVersion.Major returns the major version number correctly.Final Answer:$PSVersionTable.PSVersion.Major -> Option AQuick Check:Version check syntax = $PSVersionTable.PSVersion.Major [OK]Quick Trick: Use $PSVersionTable.PSVersion.Major to get major version [OK]Common Mistakes:Using non-existent commandsTrying to run version.ps fileAssuming Get-PSVersion exists
Master "Basics and Environment" in PowerShell9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More PowerShell Quizzes Cmdlets and Pipeline - Verb-Noun naming convention - Quiz 8hard Cmdlets and Pipeline - Pipeline concept (|) - Quiz 10hard Control Flow - If-elseif-else statements - Quiz 15hard Control Flow - Switch statement - Quiz 12easy Operators - Assignment operators - Quiz 5medium Operators - Arithmetic operators - Quiz 12easy String Operations - Select-String for searching - Quiz 11easy Variables and Data Types - Hash tables (dictionaries) - Quiz 7medium Variables and Data Types - Automatic variables ($_, $PSVersionTable) - Quiz 14medium Variables and Data Types - Why variables store data - Quiz 14medium