Install Visual Studio Code

Uninstall Visual Studio Code silently with an function is pretty nice.
Like in this post.

And to install Visual Studio Code automatic is very easy to.
Thanks to Microsoft.

If you go to the VSCode marketplace online and to the PowerShell extension.

And then scroll down to the section “Script-based Installation“.
Then you can see that the script is published on PSGallery.

If you “only” want to install Visual Studio Code as a default system installation you can run the code
from the extension page.

Install-Script Install-VSCode -Scope CurrentUser; Install-VSCode.ps1

It’s working fine. You need to press Y on 3 things. But It’s normal. You need to say Yes to set the path to where scripts should be downloaded when using Install-Script cmdlet, you need to say yes to install PowerShellGet module and say yes to trust PSGallery.

And you will get the PowerShell extension installed automatically.

If we don’t want to press yes when installing/downloading the script we can do that by doing this.
Install-Package NuGet -Force
Install-Script Install-VSCode -Scope CurrentUser -Force

If you want more extensions to be installed automatically you can add a parameter to the Install-VSCode.ps1 script.
Install-vscode.ps1 -AdditionalExtensions “extension1″,”extension2″,”extension3”

The extension name is easy to find on the online market place or in Visual Studio Code in that extension marketplace.

If you look online on a extension.
Look to the lower right area.
It’s the Unique Identifier name we need.

If you look in Visual Studio Code you will find the Unique Identifier on the right side of the Extension name.

I use this to install my VSCode with the script.
Install-vscode.ps1 -AdditionalExtensions “eamodio.gitlens”,”davidanson.vscode-markdownlint”,”vscode-icons-team.vscode-icons”,”dotjoshjohnson.xml

You can also add themes here. They are extensions as well.

Now It’s only two things left before I’m okay with my installation.

I use my Set-OpenWithVisualStudioCode function to Set Open With Code in Windows Explorer
and the last thing is to apply my basic PowerShell settings for Visual Studio Code with
my Set-BasicPSSettingsVisualStudioCode function.

My Install-VisualStudioCode.ps1 script can be downloaded from my PowerShell GitHub repository.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.