Visual Studio Code Extension
Learn about the Visual Studio Code extension for Universal.
Last updated
Learn about the Visual Studio Code extension for Universal.
Last updated
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.
The extension will prompt you for the URL and App Token used to connect to your PowerShell Universal instance. Follow the instructions within the extension when it starts up.
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 Get-Runspace
and 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.
The sample browser can be used to insert samples from the PowerShell Universal Sample Repository into your PowerShell Universal instance. Just save the files it updates and your PowerShell Universal system will reflect the changes.