PowerShell Universal can be managed with the PowerShell Universal Visual Studio Code extension. It allows you to connect to a local Universal instance and manage APIs, dashboards and scripts.
You can download the extension from the Visual Studio Marketplace. You can also download the extension from within the Visual Studio Code extension pane. Search for PowerShell Universal and click Install.
When the extension first installs, it will download the latest version of PowerShell Universal for your platform and store it in
%AppData%\PowerShellUniversal. It will then start the server, login and generate an app token. The installation directory and app token as stored in settings.
The PowerShell Universal extension adds a new activity pane panel for PowerShell Universal. It has the following sections.
You can manage APIs with the extension. You will see a list of APIs. You can click the
Open endpoints.ps1 button to view the endpoints file and add new endpoints. Clicking the refresh button will reload any endpoints you add. You can click the
Insert Invoke-RestMethod to Console to add a call to the endpoint to the PowerShell Integrated Console.
You can manage dashboards with the extension. You will see a list of dashboards underneath this section. You can open the dashboards.ps1 script, open the a single dashboard's script, restart a dashboard and view dashboards. When you open a dashboard script, the dashboard modules will automatically be loaded so that IntelliSense works in VS Code.
You can connect the Visual Studio debugger to the dashboard process by right clicking on the dashboard and click Debug Dashboard Process. This requires the PowerShell extension for Visual Studio Code.
After connecting the debugger, you can run commands such as
Debug-Runspace to begin debugging aspects of your dashboard.
You can view dashboard logs by right clicking on the dashboard and clicking View Logs. They will open in a new tab.
You can manage scripts with the extension. You will see a list of available scripts underneath this section. You can edit the scripts.ps1, edit an individual script and run scripts. When running scripts, you will receive feedback about the status of the script. Scripts with parameters are not supported in VS Code. You can still run them in PowerShell Universal.