PowerShell Language Support for Visual Studio Code
This extension provides rich PowerShell language support for Visual Studio Code. Now you can write and debug PowerShell scripts using the excellent IDE-like interface that Visual Studio Code provides.
- Windows 7 through 10 with PowerShell v3 and higher
- Linux with PowerShell v6 (all PowerShell-supported distributions)
- macOS and OS X with PowerShell v6
Read the installation instructions to get more details on how to use the extension on these platforms.
Read the FAQ for answers to common questions.
- Syntax highlighting
- Code snippets
- IntelliSense for cmdlets and more
- Rule-based analysis provided by PowerShell Script Analyzer
- Go to Definition of cmdlets and variables
- Find References of cmdlets and variables
- Document and workspace symbol discovery
- Run selected selection of PowerShell code using
- Launch online help for the symbol under the cursor using
- Local script debugging and basic interactive console support!
If you're on Windows 7 or greater with the PowerShellGet module installed, you can easily install both Visual Studio Code and the PowerShell extension by running the following command:
Install-Script Install-VSCode -Scope CurrentUser; Install-VSCode.ps1
You will need to accept the prompts that appear if this is your first time running
Alternatively you can download and execute the script directly from the web
without the use of
Install-Script. However we highly recommend that you
read the script
first before running it in this way!
iex (iwr https://git.io/vbxjj)
Installing the Extension
You can install the official release of the PowerShell extension by following the steps in the Visual Studio Code documentation. In the Extensions pane, search for "PowerShell" extension and install it there. You will get notified automatically about any future extension updates!
code --install-extension PowerShell-<version>.vsix
NOTE: If you are using VS Code Insiders, the command will be
There are some example scripts in the extension's
examples folder that you can
use to discover PowerShell editing and debugging functionality. Please
check out the included README.md file to learn more about
how to use them.
This folder can be found at the following path:
To open/view the extension's examples in Visual Studio Code, run the following from your PowerShell command prompt:
code (Get-ChildItem $Home\.vscode\extensions\ms-vscode.PowerShell-*\examples)[-1]
If you're having trouble with the PowerShell extension, please follow these instructions to file an issue on our GitHub repository:
Make sure to fill in the information that is requested in the issue template as it will help us investigate the problem more quickly.
To automatically create a bug report from within the extension, open the Command pallet (Ctrl/Cmd+Shift+P) and run the "Report a problem on GitHub" command. Some basic information about your instance and powershell versions will be collected and inserted into a new GitHub issue.
NOTE: If you believe that there is a security vulnerability in the PowerShell extension for VSCode, it must be reported to email@example.com to allow for Coordinated Vulnerability Disclosure. Only file an issue, if firstname.lastname@example.org has confirmed filing an issue is appropriate.
2. Capture verbose logs and send them to us
If you're having an issue with crashing or other erratic behavior, add the following line to your User Settings in Visual Studio Code:
Restart Visual Studio Code and try to reproduce the problem. Once you are done with that, zip up the logs in the corresponding folder for your operating system:
- Linux and macOS:
Alternatively, you can open the log folder using the Command pallet (Ctrl/Cmd+Shift+P) and running the "Open powerShell Extension Logs Folder" command.
You have two options for sending us the logs:
If you are editing scripts that contain sensitive information (intellectual property, deployment or administrative information, etc), e-mail the logs directly to email@example.com.
If you are editing scripts that don't contain sensitive information, you can drag and drop your logs ZIP file into the GitHub issue that you are creating.
Contributing to the Code
Check out the development documentation for more details on how to contribute to this extension!