A good example to start with is to retrieve, download, and install the latest PowerShell Core version. The code shows how to work with directories and JSON. It is written as a simple function, and retrieves the latest PowerShell versions from GitHub and validates the currently used PowerShell version on its GitCommitId
. Make sure you are executing the code with PowerShell Core 6. In the bottom-right corner of Visual Studio Code, you will be able to check which PowerShell version is currently in use, as follows:
As you can see from this example, PowerShell version 6 is currently being used. After you have clicked on it, the settings will show up and you will be able to choose between the different PowerShell versions:
#Retrieves the latest PowerShell Core version - mainly built for Windows OS. Function Get-LatestPowerShellVersion { #Using TLS 1.2 [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 #Retrieving the latest...