$PSVersionTable.PSVersion command not working

mess iya 0 Reputation points
2025-06-11T14:49:54.1466667+00:00

Powershell cloud command $PSVersionTable.PSVersion is not working

This question is related to the following Learning Module

PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,970 questions
0 comments No comments
{count} votes

2 answers

Sort by: Newest
  1. Michael Taylor 59,991 Reputation points
    2025-06-11T15:02:10.05+00:00

    It would be helpful if you could share with us how it isn't working. For example, you get an error message (what error)?, it does nothing, you cannot get to the session window, etc.

    To use most MS Learn tutorials, such as this, you first need to grant it access to your MS account. That is the big message at the top of the module where it says to review permissions. Once you've done that then it will start the cloud shell window.

    However it defaults to Bash, not Powershell. That is what Step 1 tells you to change. Click the Switch to Powershell button in the shell and confirm the switch. It will then switch to Powershell, which is what the module is for. You can tell this because the CLI lines will start with PS.

    Now you can continue on with steps 2+.

    0 comments No comments

  2. Q&A Assist
    2025-06-11T14:49:54.24+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    It seems that you are having trouble with the $PSVersionTable.PSVersion command in PowerShell. This command is typically used to retrieve the version of PowerShell that is currently running. If it is not working, it could be due to several reasons:

    1. PowerShell Environment: Ensure that you are running the command in a valid PowerShell environment. If you are using a different shell or command prompt, the command may not be recognized.
    2. Version Compatibility: If you are using an outdated version of PowerShell, it might not support certain commands. You can check for updates or install the latest version of PowerShell.
    3. Execution Policy: Sometimes, the execution policy settings may prevent certain commands from running. You can check and modify the execution policy if necessary.

    If you continue to experience issues, consider providing more details about the error message or behavior you are encountering.


    References:

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.