Refs:

Installing PowerShell on Windows

Visual Studio Code on Windows

Using Visual Studio Code for PowerShell Development

Setup PowerShell

In a browser on the target computer visit GitHub PowerShell releases, scroll down to Assets and find the latest PowerShell win-x64 msi (or, perhps, win-32 msi), clicking on the link to download and save where you can find it. At this writing the direct links are

PowerShell-7.0.3-win-x64.msi

PowerShell-7.0.3-win-x86.msi

Run the download (or double-click it after downloading) and (recommended) just accept the defaults except on the Optional Actions when selecting all items is suggested. Click Next or Install as appropriate and, suggested, Launch PowerShell when the install is completed (click Finish).

Keep your PowerShells straight: There is the preinstalled Windows PowerShell (version 5.x) which starts from the command powershell and the newly installed PowerShell (version 7.x) which starts from the command pwsh (or the Start menu can be used). In any flavor of PowerShell using (Get.Host).Version will show the version that is running. See PowerShell section for versioning details.

 

Setup Visual Studio Code

Like many (too many, IMHO) modern applications Visual Studio Code defaults to installing a version for each user in their AppData folder. This is -- maybe -- ok for a single user device but part of the point of a server is one install that all qualified users can run: for a 150 user server or network why have 150 installs of the same product? So a 'system setup' is preferred for our use case. Downloading and running VSCodeSetup-x64 on the target machine is the recommended approach. Defaults are recommended except on the fourth Select Additional Tasks screen where all boxes are (recommended) checked; click Next or Install as appropriate.

To add Powershell Extensions in VS Code use Go | Go to File from the menu or Ctrl + P and use ext install powershell as the search criteria. Click Install next to a PowersShell extension from Microsoft and it will begin installing. After installation you can select a color scheme (FWIW I like the white background with blue trim ISE look rather than the dark shark look).

 

A Quick Test

Use File | New and immediately File | Save As saving a PowerShell script (extension .ps1 e.g., demo.ps1) then enter and run a trivial PowerShell script  (use Run | Run Without Debugging).