Exercise - Run your first PowerShell commands
Note
In this unit, you use Azure Cloud Shell as a terminal. You can access Cloud Shell through the Azure portal or the Cloud Shell sign-in. You don't have to install anything on your PC or laptop to use it.
Note
In this module, you're using the Azure Cloud Shell, but you can also use the integrated Terminal in Visual Studio Code by selecting Terminal > New Terminal, then selecting Powershell in the drop-down in the top-left of the Terminal window.
Note
This exercise is optional. If you want to complete this exercise, you'll need to create an Azure subscription before you begin. If you don't have an Azure account or you don't want to create one at this time, you can read through the instructions so you understand the information that's being presented.
Open the Azure Cloud Shell. If it isn't already using PowerShell, select PowerShell from the drop-down menu, and then select Confirm.
Run the following command in Cloud Shell, and then press Enter to verify that your system is set up to use PowerShell. The
$PSVersionTableverifies your installation.$PSVersionTableYour output resembles the following table:
Name Value ---- ----- PSVersion 7.3.6 PSEdition Core GitCommitId 7.3.6 OS Linux 5.4.0-1058-azure #60~18.04.1-Ubuntu SMP Tue Aug 31 20:34:4… Platform Unix PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…} PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1 WSManStackVersion 3.0The output provides information about your PowerShell version, and your platform and edition.
For information limited to your version of PowerShell, you can run a modified version of
$PSVersionTable.Run the following command in Cloud Shell, and then press Enter.
$PSVersionTable.PSVersionYour output now resembles the following table:
Major Minor Patch PreReleaseLabel BuildLabel ----- ----- ----- --------------- ---------- 7 3 6This output gives you more details about your version of PowerShell.
Running $PSVersionTable results in output that looks like a table, but is actually an object. For this reason, you can use a period (.) to access a specific property, such as PSVersion.