Replicate VS Code Extensions Using PowerShell

What is Visual Studio Code?

From Wikipedia,
Visual Studio Code is a source code editor developed by Microsoft for Windows, Linux and MacOS.
It includes support for debugging, embedded Git control, syntax highlighting, intelligent code completion, snippets, and code refactoring.
It is also customizable, so users can change the editor’s theme, keyboard shortcuts, and preferences.
It is free and open-source,although the official download is under a proprietary license.


Extensions in Visual Studio Code

VS Code extensions let you add languages, debuggers, tools, add new features and themes to your installation to support your development workflow and experience.
Visual Studio Code has support for almost every major programming language.
You can find extensions to install using the Extensions View.
You can install extensions the ones you like, and disable extensions you don’t want to use all the time.

How do I get consistent VS Code experience?

It’s already available on Windows, Linux and MacOS. So even if you move between environments and type of operating systems you can still get the same VS Code experience.
To make it even seemless it would be good if you can get the extensions also available when you move between different machines. Like the way you get your roaming profile and desktop experience on Windows operating system.

There are few extensions available to solve this problem. The two prominently found on marketplace are,

  1. Settings Sync
  2. Extension Manager

I wanted to try something simple as I often create virtual machines for testing, training labs.
I have already automated the VS Code silent install using PowerShell Remoting. To extend that effort, I wanted to install extensions as well, so that once my virtual machine(s) is/are ready I can start using VS Code with same experience as my physical laptop.

I added following lines of code which using VS Code command line and PowerShell remoing command (Invoke-Command)

# Setting up credentials for remote session on VMs from Host Machine.    
$hostCredential = New-Object PSCredential("MachineName\Administrator", ('mypassword' | ConvertTo-SecureString -AsPlainText -Force))

# Find the Visual Studio Code Extensions Installed and store in variable   
$vscodeExtensions = code --list-extensions

# Install Desired Visual Studio Code Extensions
# Using foreach to iterate through list of extensions in $vscodeExtensions.
# Using Invoke-Command installs the extension on remote computer.
Invoke-Command -AsJob -ScriptBlock {
foreach ($vce in $using:vsccodeExtensions){
code --install-extension $vce 
} -ComputerName MachineName -Credential $hostCredential -Verbose 

# Verify Visual Studio Code Extensions are installed on remote machine
Invoke-Command -ScriptBlock {code --list-extensions} -ComputerName MachineName -Credential $hostCredential -Verbose

This slideshow requires JavaScript.


  • I have tried this to replicate extensions found in Visual Studio Code installed on my Windows 10 laptop to Visual Studio Code installed on Windows 2012 Server Virtual Machine.
  • I have not tested this method with all possible extensions however I feel this should work unless there are any specific dependencies (missing) of extension blocking the installation.
  • You can use the same techique to uninstall extensions from remote command and code should look like
Invoke-Command -AsJob -ScriptBlock {
foreach ($vce in $using:vsccodeExtensions){
code --uninstall-extension $vce 
} -ComputerName MachineName -Credential $hostCredential -Verbose

Thats’s it for now. Thanks for reading!!!

PowerShell ISE on Ubuntu 14.04

In the last post covered the initial steps for

  • Installing PowerShell on Ubuntu 14.4
  • Running basic PowerShell Commands (cmdlets)

After doing that I was curious to understand how the PowerShell ISE works on open source. Some answers are available at PowerShell Magazine

search for “tmux”
search for “ISESteroids”

I have not worked on both of them so skip commenting on it for now.

I had heard about Visual Studio Code and PowerShell language support. I found some hints in the post Microsoft has open-sourced PowerShell for Linux, Macs. Repeat, Microsoft has open-sourced PowerShell

So with above, I tried testing script editing capabilities with Visual Studio Code on Ubuntu 14.04

Step 1 – Go To Visual Studio Code On Ubuntu 14.4 (


Step 2 – Download the .deb



Step 3 – Install Visual Studio Code

sudo dkpg –install ~/Downloads/code_1.4.0-1470329130_amd64.deb



Step 4 – Launch Visual Studio Code



Step 5 – Install the Extension For PowerShell




Step 6 – Enable PowerShell Extension


Step 7 – Restart Visual Studio Code


Step 8 – Launch Visual Studio Code and Save the Untitled file as Test1.ps1 file


Step 9 – Write PowerShell Commands. You will notice intellisence support available.



Step 10 – Go to Menu > View > Integrated Terminal (shortcut cntl + `)
It opens the bash terminal by default


Step 11 – Change Default Terminal from Menu > File > Preferences > User Settings

You will notice settings.json is empty. Whatever settings you add will override the default settings. I added entry to point to PowerShell.



Added following lines of code

//The path of the shell that the terminal uses on Linux.

“”: “/opt/microsoft/powershell/6.0.0-alpha.9/powershell”


Step 12 – Restart Visual Studio Code

Step 13 – Go to Menu > View > Integrated Terminal (shortcut cntl + `)

It opens the PowerShell terminal by default now.


Step 14 – Type $PSVersionTable in console (terminal) and enter


Step 15 – In the editor type Get-ChildItem and Hit F8 key

It will run the command and produce the output but you won’t see it.

Step 16 – To see the output Go to Menu > View > Output


So Lessons Learnt are,

  • As of now, there is no official news on PowerShell ISE coming on open source.
  • Having said that, this is really a good beginning towards any client to any server management capabilities with PowerShell and Visual Studio Code (with PowerShell Extension). As it gets to final release and stabilizes in community, I expect to become more rich and smoothly integrated with open source editor (or with editing tool experiences)
  • The intellisence were not working consistently and fluently. There could be something about my VM. I will test later with another VM . I also check in communities for any such observations.

That’s it for now. I will continue exploring capabilities over next few days, So stay connected.