TfsCmdlets: PowerShell Cmdlets for Azure DevOps and Team Foundation Server

GitHub license Build status GitHub release Issues Forks Stars

PowerShell Gallery NuGet Chocolatey GitHub all releases

What is TfsCmdlets?

TfsCmdlets is a PowerShell module which provides many commands (“cmdlets” in PowerShell parlance) to simplify automated interaction with Azure DevOps (Server 2019+ and Services) and Team Foundation Server (up to 2018).

By using TfsCmdlets, TFS administrators (even power users) can create scripts to automate many different tasks, ranging from retrieving work items to create new team project collections.

TfsCmdlets is available in many formats. The full (MSI-based) installer also includes Azure DevOps Shell, a PowerShell window pre-configured to make interacting with TFS via command line a joy!

Azure DevOps Shell

Quick start guide

Firstly, download and configure the latest version of the Visual Studio ALM Virtual Machine (a.k.a “Brian Keller VM”) in your computer in order to have a sandbox to play with.

Next, install TfsCmdlets inside the virtual machine (see section “How to install”, below), open a PowerShell window and try the following commands:

# Connect to the FabrikamFiber team project collection
# (Will be used as default for the -Collection argument when required by a cmdlet)
Connect-TfsTeamProjectCollection http://vsalm:8080/tfs/FabrikamFiberCollection

# Get a list of team projects in the currently connected TPC

# List the existing iterations in the FabrikamFiber team project
Get-TfsIteration -Project FabrikamFiber

# Connect to the FabrikamFiber team project
# (will be used as default for the -Project argument when required by a cmdlet)
Connect-TfsTeamProject FabrikamFiber

# Create a new iteration
New-TfsIteration 'Release 3'

# Get all bugs in the current team project
Get-TfsWorkItem -Filter '[System.WorkItemType] = "Bug"'

# Create a new PBI in the 'Release 3' iteration
New-TfsWorkItem -Title 'New product backlog item' -Type 'Product Backlog Item' -Fields @{'System.IterationPath'='Release 3'}

How to install

TfsCmdlets can be obtained from many different sources and in many different formats. Choose the one most suitable to you!

If you’re using Windows 10, Windows Server 2016 (or later) or installed Windows Management Framework 5 (or later) then the simplest way to install TfsCmdlets is via PowerShell Gallery.

Open an elevated PowerShell prompt and type:

Install-Module TfsCmdlets

Optionally, you can install it locally in your user profile. That is particularly useful when you can’t run as an administrator or don’t want to make the module available to all users in the computer:

Install-Module TfsCmdlets -Scope CurrentUser

Additional information


Using Chocolatey? Then open an elevated PowerShell prompt and type:

# To install the latest pre-release (alpha, beta) version of TfsCmdlets, type:
choco install TfsCmdlets -pre

# To install the latest final release version of TfsCmdlets, type:
choco install TfsCmdlets


Nuget is a great option if you need to integrate TfsCmdlets with your continuous integration process (e.g. you need to create a TFS work item during the execution of an automated build).

To add TfsCmdlets to your solution, search for TfsCmdlets in the Visual Studio “Manage Nuget packages for solution…” dialog.

  • Note: To add the latest pre-release version of TfsCmdlets, don’t forget check the “Include prerelease” checkbox

Additional information

Offline installation

When the target machine is not connected to the internet, none of the options above are available. In that case, your best bet is one of the offline installation alternatives below.

You can get one of the offline installers listed below from the GitHub Releases page.

Full installer (MSI-based)

The full installer will install the module files to the Program Files folder in your computer, make the module available to PowerShell and create the Azure DevOps Shell icon in the Start Menu.

To install the full installer:

  • Download the MSI file from the Releases page;
  • Open the downloaded MSI file
    • NOTE: If Windows SmartScreen flags the file as insecure and refuses to run it, you can click the “More info” button/link in the dialog and select the “Run anyway” option.

To uninstall the full installer:

  • Use the Programs and Features (formerly “Add and remove programs”) function in the Windows Control Panel.

Portable installer

The portable installer is a zip file containing all the required the module files.

To install the portable installer:

  • Download the zip file from the Releases page;
  • Open your Documents folder in Windows, then open the WindowsPowerShell folder in it;
  • Inside the WindowsPowerShell folder, create a new folder called Modules in it (if missing) and then create a new folder called TfsCmdlets in Modules;
  • Extract the contents of the zip file to the TfsCmdlets folder.

You must end up with a folder structure similar to [Documents]\WindowsPowerShell\Modules\TfsCmdlets. Files such as TfsCmdlets.psd1 must be located in the TfsCmdlets folder.

To test the installation, open a new PowerShell window and type:

Import-Module TfsCmdlets

To uninstall the portable installer

  • Close all PowerShell windows where you were using TfsCmdlets (to free files in use);
  • Delete the TfsCmdlets folder from the [Documents]\WindowsPowerShell\Modules folder.

Contribution Guidelines

Additional Information