In my guide Create a Lab Machine, I walk you through the complete process of setting up a virtual Lab Machine running Windows 11 within Hyper-V using the Quick Create feature.

This includes configuring the language settings properly to suit your preferences, installing the latest version of PowerShell 7 for enhanced scripting testing, and setting up Visual Studio Code along with several useful extensions to streamline your development workflow.

In this guide I will show you some helpfull tips and trix on setting up Visual Studio Code for PowerShell editing.

All the code and information provided on this website are offered “as is” without any guarantees or warranties of any kind. Although the code and information are tested, we do not warrant that the code is error-free or that it will meet your specific requirements. Use the code at your own risk. We disclaim all liability for any damages or losses arising from the use or inability to use the provided materials.

Settings menu

We can configure all of our settings within the dedicated settings section.
This particular section can be accessed through several different methods.

One common way is by clicking the Manage icon located at the bottom left corner of the screen, and then selecting Settings from the menu that appears.

Alternatively, you can access it by clicking on the Manage icon first, followed by selecting the Command Palette. Another way is to press the keyboard shortcut Ctrl+Shift+P, and then type settings in the search bar. From the search results, choose the option labeled “Open settings (UI)” to proceed.

Default language

When creating a PowerShell script file we want to go to File and Click on New Text File for a new PowerShell Script.

But as default in Visual Studio Code a New Text File is not associated with PowerShell.

To fix this we need go to the settings section as described above and search for “Default Language“.

Then enter powershell in the Files: Default Language text box.

If you write PowerShell as Microsoft and the PowerShell community recommend, it will not work…

so we need to write powershell using only lowercase letters

Tab completion

Another thing that is not there by default is Tab Completion.
This is because Visual Studio Code is not just made for PowerShell.

To enable tab completion we need to search for Tab Completion in the Settings search.

And in the Editor: Tab Completions section, change off to on.

Mouse Wheel Zoom

Another seeting that I can’t be without is the Mouse Wheel Zoom setting, both for the editor and the terminal window.

It will enable zoom the font of the editor and terminal when using mouse wheel and holding Ctrl.

In the video below I show first when using Mouse Wheel Zoom on the editor and then using on the terminal window.

The font size for the terminal window is better to set with the Terminal Font Size setting. This is described below.

Terminal Font Size

The terminal font size is pretty small as default and as you can see in the video with the mouse wheel zoom, it can be a challenge to get a good size of the terminal font with the mouse wheel.

So it’s easier to use the settings search and search for terminal font size and change the Terminal > Integrated: Font Size.

I like 20, at least when I share my screen and show something in Visual Studio Code. But I think the settings is pretty personal so you need to test for your self.

The End

These were my fundamental and essential settings for Visual Studio Code specifically tailored for working with PowerShell.
These are truly my “must-have” configurations that I rely on for an optimized coding experience!

In the near future, I plan to share a detailed guide explaining how to export and import your Visual Studio Code settings using various methods.

This way, you won’t have to go through the hassle of manually adjusting your preferences every time you start working on a new computer or find yourself in a lab environment.


Leave a Reply

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

The PowerAdmin
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.