Git Integration with VS Code: Part 1 – Upgrading PowerShell

So, I’ve been wanting to do this blog series for quite some time, and I’ve been working to put all of the various bits together. When I first started writing scripts for PowerCLI, I would simply write them using either the native Windows PowerShell ISE or some other text editor like Notepad++. It was fine for a while, but I soon began running into issues with version control. Before I knew it, I quickly ended up with a multitude of files in a folder. Things like script-draft.ps1, script-edited.ps1, script-edit2.ps1, script-working.ps1, script-final.ps1, script-FINAL-20180311.ps1, etc. It quickly got to the point where I didn’t know which files had the latest changes to them, or which ones had the newest feature I  implemented (or was trying to implement). Does any of this sound familiar?

At a recent Western PA VMUG meeting, I was introduced to this new product (to me, at least) called Visual Studio Code. Sure, it was another place to work on developing and even running PowerShell and PowerCLI scripts, but I had no idea how about the concept of version control or Git integration that lied within. All of that stuff was completely foreign to me, but sounded interesting. And, with the help of the #vCommunity and some of my own research, I finally got to a point where I understood how I could integrate my VS Code editor with my online GitHub account, and keep them in sync across multiple devices.

For me, setting up VS Code to integrate with my GitHub account seemed like a rather intimidating task, especially at first. Now that I have everything configured and working, I thought it would be a good idea to share my process and what I discovered with others who might be wanting to do the same thing. The blog series will be broken down into the following parts:

According to the Compatibility Matrix for VMware PowerCLI v10, a minimum of PowerShell version 3 (shipped with Windows 8.0) is required to install. But, I still decided to upgrade to PowerShell version 5.1 on my Windows system to take advantage of the latest features and cmdlets. (As of this writing, PowerCLI v10 was not yet certified for use with PowerShell 6.0 on Windows).

Upgrading PowerShell

Check your current version of PowerShell

  • Open a new PowerShell window and run the following command:
  • In the screen output, look for the version number listed in the Major column. In this example taken from a clean, but fully patched Windows 7 SP1 install, PowerShell version 2 was installed.

Upgrade PowerShell, if needed

  • From the Microsoft Download Center, search for the Windows Management Framework.
  • In this instance, I downloaded Windows Management Framework version 5.1.03-download-windows-management-framework
  • When choosing the download, match the version to the OS you’ll be installing to. In this example, I chose the version for Windows 7/2008 R2.
  • Depending on the version downloaded, double-click on the .msu file (or extract the .zip file to get to the .msu file).
  • In the Windows Update Standalone Installer dialog, click Yes.
  • In the Download and Install Updates dialog, click I Accept. (Unless of course, you disagree with the terms).
  • When prompted, restart your computer for the changes to apply.
  • Now the that PowerShell upgrade is complete, run the $PSVersionTable.PSVersion command again to see the version changes.
  • After restarting the computer, be sure to check for OS updates, as there may be some additional patches that may need to be downloaded and applied as a result of upgrading PowerShell.

Well, that concludes Part 1 of this “Git Integration with VS Code” blog series. Coming up next, Part 2 – Installing PowerCLI and Git.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: