PowerShell setup in VSCode

Moving to my new Microsoft surface and setting up VSCode again to use with powershell. I’m documenting my setup in this blog post so its easier next time.

First is setting up VScode with plugins and configuration.

Mike has the first steps on getting VSCode install and the powershell and vscode-icons install

https://mikefrobbins.com/2017/08/24/how-to-install-visual-studio-code-and-configure-it-as-a-replacement-for-the-powershell-ise/

Keyboard shortcuts details

Customize Visual Studio Code keyboard shortcuts

Visual Studio Code also enables you to customize keyboard shortcuts. To customize keyboard shortcuts, select Command Palette from the View menu or press Ctrl+Shift+P (Cmd + P on the Mac), and then type keyboard. Then, select Preferences: Open Keyboard Shortcuts.

Just like with user settings, Visual Studio Code will open two editor windows side-by-side. The editor window on the left, lists all the default keyboard shortcuts and is read-only. The editor window on the right is for your customized keyboard shortcuts.

Editor window for customized keyboard shortcuts

https://blogs.technet.microsoft.com/heyscriptingguy/2016/12/05/get-started-with-powershell-development-in-visual-studio-code/

Here are two great post on how to setup VSCode, the more you know the better 🙂

How to run PowerShell code in VSCode

Setup VS Code for PowerShell

Powershell profiles

Here are a few post about the basics of powershell profiles.

Windows PowerShell Profiles

Customizing your PowerShell Profile

If you’ve been using ISE for your powershell needs, you need to know that vscode uses a different file for your $profile.

Checkout the post below to see how to create the new $profile

Visual Studio Code: PowerShell Profile

I’d like to have the date and time on the prompt so I add the code below to my $profile

function prompt
{
“PS ” + $(get-location) + ” [$(Get-Date)]> ”
}

O365 and powershell

I use powershell with o365 all the time so to connect to all the o365 services follow this post.

Connect to all Office 365 services in a single Windows PowerShell window

Leave a Reply

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