Archive

Posts Tagged ‘editor’

Team Foundation Services and PowerGUI – Using PowerShell with Version Control

April 29, 2013 15 comments

Version control allows you and others to work on the same scripts, check them in and out, etc. By following these steps, it is possible to use version control system for PowerShell as well as a number of other programming languages.

For PowerShell, PowerGUI is by far my favourite GUI/Script Editor, it is free, far superior to ISE (which is improving) and my preference to PrimalScript. Although PowerGUI is my preference for PowerShell development, for pretty much all other scripting, PrimalScript is superb.

Primal’s PowerShell Studio is an excellent PowerShell GUI/Script Editor. It has a similar feature set to PowerGUI, with some advantages and some disadvantages- one thing that it excels at is PowerShell GUI development.

One thing that PowerGUI, PowerShell Studio and PrimalScript all have in common, is that they support the MSSCCI provider/Source Control Plug-in API. The following guide shows you how to install the provider and configure PowerGUI to use it.

Requirements

Installation Instructions

As there are many options for TFS, I will not go into installation and setup of TFS. For the examples, I will be using Team Foundation Services Online.

  1. Install the PowerGUI Script Editor.
  2. Accept the license agreements and install the defaults.
  3. Launch setup for Team Explorer for Visual Studio 2012.
  4. Agree to the license agreement and press the Install button.
  5. Press the ‘Launch’ button once installation has completed.
  6. Launch the Microsoft Visual Studio Team Foundation Server 2012 MSSCCI Provider. This is the 32-bit installer and is required for PowerGUI and other script editors.

Configure Team Foundation Server Explorer

  1. Press the ‘Connect to Team Foundation Server’ and press the ‘servers’ button.
  2. Press ‘Add…’ and enter details of the Team Foundation Server. Press OK. (you may be prompted to sign in)
  3. Press the close button.
  4. Select the Team Projects you wish to import. Press ‘Connect’.
  5. Click the Source Control Explorer link.
  6. Right click and choose ‘Add Items to Folder’. Choose a PowerShell Script to upload.

Configure PowerGUI to use Team Foundation Server

  1. Launch PowerGUI Script Editor.
  2. Select the ‘Tools’ menu -> ‘Options’.
  3. Select ‘Version Control’. Select ‘Team Foundation Server MSSCCI Provider’. Click Advanced.
  4. Select Check In and press OK, and OK again.
  5. PowerGUI will now have a ‘Version Control’ menu.
  6. Choose ‘Get Files from Version Control’.
  7. The Team Foundation Server should be available in the list. Click OK.
  8. Expand $/ and select the project beneath.
  9. Click the ‘Browse’ button. Create a new folder for the local copy of the script repository.
  10. Press OK.
  11. After a few moments (depending on speed of connection to the TFS server) an Open dialog will be shown.
  12. Open the sample script.

Using Team Foundation Server with PowerGUI

  • Creating a new script in the folder linked with the repository will cause it to be uploaded to TFS.
  • Modifying a script checks it out.