Setup PowerShell in Ubuntu
Refs:
Installing PowerShell on Linux
Using Visual Studio Code for PowerShell Development
Setup PowerShell
With a desktop Linux deployment a browser can be used to visit the download sites and install PowerShell and VS Code using the desktop GUI (e.g., see Refs above). With Ubuntu it's easier from a terminal command line. Be sure updates have been downloaded and applied first
sudo apt-get update
sudo apt-get upgrade
and maybe a restart if it's convenient (just to be on the safe side)
sudo shutdown -r now
Then PowerShell can be installed with
sudo snap install powershell --classic
Using the command pwsh after installation should start a PowerShell console (within Terminal); note the PS in the prompt. The exit command will, well, exit PowerShell.
pwsh
PowerShell 7.0.3
Copyright (c) Microsoft Corporation. All rights reserved.
https://aka.ms/powershell
Type 'help' to get help.
PS /home/tschultz>exit
Setup Visual Studio Code
If VS Code isn't already installed it can be installed with
sudo snap install code --classic
after which the command code should open a VS Code window (VS Code can also be opened from the desktop via applications)
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).