Downloads:
5,021
Downloads of v 1.0.0-alpha7:
299
Last Update:
22 Oct 2015
Package Maintainer(s):
Software Author(s):
- Igor Abade V. Leite
Tags:
tfscmdlets tfs powershell- Software Specific:
- Software Site
- Software License
- Package Specific:
- Possible Package Source
- Package outdated?
- Package broken?
- Contact Maintainers
- Contact Site Admins
- Software Vendor?
- Report Abuse
- Download
TfsCmdlets
This is a prerelease version of TfsCmdlets.
- 1
- 2
- 3
1.0.0-alpha7 | Updated: 22 Oct 2015
- Software Specific:
- Software Site
- Software License
- Package Specific:
- Possible Package Source
- Package outdated?
- Package broken?
- Contact Maintainers
- Contact Site Admins
- Software Vendor?
- Report Abuse
- Download
Downloads:
5,021
Downloads of v 1.0.0-alpha7:
299
Maintainer(s):
Software Author(s):
- Igor Abade V. Leite
TfsCmdlets 1.0.0-alpha7
This is a prerelease version of TfsCmdlets.
Legal Disclaimer: Neither this package nor Chocolatey Software, Inc. are affiliated with or endorsed by Igor Abade V. Leite. The inclusion of Igor Abade V. Leite trademark(s), if any, upon this webpage is solely to identify Igor Abade V. Leite goods or services and not for commercial purposes.
- 1
- 2
- 3
Some Checks Have Failed or Are Not Yet Complete
Not All Tests Have Passed
Validation Testing Unknown
Verification Testing Unknown
Scan Testing Successful:
No detections found in any package files
Deployment Method: Individual Install, Upgrade, & Uninstall
To install TfsCmdlets, run the following command from the command line or from PowerShell:
To upgrade TfsCmdlets, run the following command from the command line or from PowerShell:
To uninstall TfsCmdlets, run the following command from the command line or from PowerShell:
Deployment Method:
This applies to both open source and commercial editions of Chocolatey.
1. Enter Your Internal Repository Url
(this should look similar to https://community.chocolatey.org/api/v2/)
2. Setup Your Environment
1. Ensure you are set for organizational deployment
Please see the organizational deployment guide
2. Get the package into your environment
Option 1: Cached Package (Unreliable, Requires Internet - Same As Community)-
Open Source or Commercial:
- Proxy Repository - Create a proxy nuget repository on Nexus, Artifactory Pro, or a proxy Chocolatey repository on ProGet. Point your upstream to https://community.chocolatey.org/api/v2/. Packages cache on first access automatically. Make sure your choco clients are using your proxy repository as a source and NOT the default community repository. See source command for more information.
- You can also just download the package and push it to a repository Download
-
Open Source
-
Download the package:
Download - Follow manual internalization instructions
-
-
Package Internalizer (C4B)
-
Run: (additional options)
choco download tfscmdlets --internalize --version=1.0.0-alpha7 --pre --source=https://community.chocolatey.org/api/v2/
-
For package and dependencies run:
choco push --source="'INTERNAL REPO URL'"
- Automate package internalization
-
Run: (additional options)
3. Copy Your Script
choco upgrade tfscmdlets -y --source="'INTERNAL REPO URL'" --version="'1.0.0-alpha7'" --prerelease [other options]
See options you can pass to upgrade.
See best practices for scripting.
Add this to a PowerShell script or use a Batch script with tools and in places where you are calling directly to Chocolatey. If you are integrating, keep in mind enhanced exit codes.
If you do use a PowerShell script, use the following to ensure bad exit codes are shown as failures:
choco upgrade tfscmdlets -y --source="'INTERNAL REPO URL'" --version="'1.0.0-alpha7'" --prerelease
$exitCode = $LASTEXITCODE
Write-Verbose "Exit code was $exitCode"
$validExitCodes = @(0, 1605, 1614, 1641, 3010)
if ($validExitCodes -contains $exitCode) {
Exit 0
}
Exit $exitCode
- name: Install tfscmdlets
win_chocolatey:
name: tfscmdlets
version: '1.0.0-alpha7'
source: INTERNAL REPO URL
state: present
allow_prerelease: yes
See docs at https://docs.ansible.com/ansible/latest/modules/win_chocolatey_module.html.
chocolatey_package 'tfscmdlets' do
action :install
source 'INTERNAL REPO URL'
version '1.0.0-alpha7'
options '--prerelease'
end
See docs at https://docs.chef.io/resource_chocolatey_package.html.
cChocoPackageInstaller tfscmdlets
{
Name = "tfscmdlets"
Version = "1.0.0-alpha7"
Source = "INTERNAL REPO URL"
chocoParams = "--prerelease"
}
Requires cChoco DSC Resource. See docs at https://github.com/chocolatey/cChoco.
package { 'tfscmdlets':
ensure => '1.0.0-alpha7',
install_options => ['--prerelease'],
provider => 'chocolatey',
source => 'INTERNAL REPO URL',
}
Requires Puppet Chocolatey Provider module. See docs at https://forge.puppet.com/puppetlabs/chocolatey.
4. If applicable - Chocolatey configuration/installation
See infrastructure management matrix for Chocolatey configuration elements and examples.
This package is exempt from moderation. While it is likely safe for you, there is more risk involved.
PowerShell Cmdlets for TFS and VSO
<#
.SYNOPSIS
Gets the installation path of a given Team Foundation Server component.
#>
Function Get-TfsInstallationPath
{
[CmdletBinding()]
[OutputType([string])]
Param
(
[Parameter()]
[string]
[Alias('Session')]
$Computer,
[Parameter()]
[ValidateSet('BaseInstallation', 'ApplicationTier', 'SharePointExtensions', 'TeamBuild', 'Tools', 'VersionControlProxy')]
[string]
$Component = 'BaseInstallation',
[Parameter()]
[string]
$Version = '12.0',
[Parameter()]
[System.Management.Automation.Credential()]
[System.Management.Automation.PSCredential]
$Credential = [System.Management.Automation.PSCredential]::Empty
)
Process
{
$scriptBlock = New-ScriptBlock -EntryPoint '_GetInstallationPath' -Dependency 'Test-RegistryValue', 'Get-RegistryValue'
return Invoke-ScriptBlock -ScriptBlock $scriptBlock -Computer $Computer -Credential $Credential -ArgumentList $Version, $Component
}
}
Function _GetInstallationPath($Version, $Component)
{
return Get-InstallationPath @PSBoundParameters
}
Function Test-RegistryValue
{
Param
(
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
$Path,
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
$Value
)
Process
{
try
{
Get-RegistryValue -Path $Path -Value $Value | Out-Null
return $true
}
catch {}
return $false
}
}
Function Get-RegistryValue
{
Param
(
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
$Path,
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
$Value
)
Process
{
return Get-ItemProperty -Path $Path | Select-Object -ExpandProperty $Value
}
}
Function Get-InstallationPath
{
Param
(
[string]
$Version,
[string]
$Component
)
$rootKeyPath = "HKLM:\Software\Microsoft\TeamFoundationServer\$Version"
if ($Component -eq 'BaseInstallation')
{
$componentPath = $rootKeyPath
}
else
{
$componentPath = "$rootKeyPath\InstalledComponents\$Component"
}
if (-not (Test-RegistryValue -Path $rootKeyPath -Value 'InstallPath'))
{
throw "Team Foundation Server is not installed in computer $env:COMPUTERNAME"
}
if (-not (Test-RegistryValue -Path $componentPath -Value 'InstallPath'))
{
throw "Team Foundation Server component '$Component' is not installed in computer $env:COMPUTERNAME"
}
return Get-RegistryValue -Path $componentPath -Value 'InstallPath'
}
Function New-ScriptBlock($EntryPoint, [string[]]$Dependency)
{
$entryPoint = (Get-Item "function:$EntryPoint").Definition.Trim()
$paramSection = $entryPoint.Substring(0, $entryPoint.IndexOf("`n"))
$bodySection = $entryPoint.Substring($paramSection.Length) + "`n`n"
$body = $paramSection
foreach($depFn in $Dependency)
{
$f = Get-Item "function:$depFn"
$body += "Function $f `n{`n"
$body += $f.Definition
$body += "`n}`n`n"
}
$body += $bodySection
return [scriptblock]::Create($body)
}
Function Invoke-ScriptBlock($ScriptBlock, $Computer, $Credentials, $ArgumentList)
{
if (-not $Computer)
{
return Invoke-Command -ScriptBlock $scriptBlock -ArgumentList $ArgumentList
}
elseif ($Computer -is [System.Management.Automation.Runspaces.PSSession])
{
return Invoke-Command -ScriptBlock $scriptBlock -Session $Computer -ArgumentList $ArgumentList
}
return Invoke-Command -ScriptBlock $scriptBlock -ComputerName $Computer -Credential $Credential -ArgumentList $ArgumentList
}
<#
.SYNOPSIS
Gets one or more Areas ("Area Paths") from a given Team Project.
.PARAMETER Area
Specifies the name, URI or path of an Area. Wildcards are permitted. If omitted, all Areas in the given Team Project are returned.
To supply a path, use a backslash ("\") between the path segments. Leading and trailing backslashes are optional.
When supplying a URI, use URIs in the form of "vstfs:///Classification/Node/<GUID>" (where <GUID> is the unique identifier of the given node)
.PARAMETER Project
Specifies either the name of the Team Project or a previously initialized Microsoft.TeamFoundation.WorkItemTracking.Client.Project object to connect to. If omitted, it defaults to the connection opened by Connect-TfsTeamProject (if any).
For more details, see the Get-TfsTeamProject cmdlet.
.PARAMETER Collection
Specifies either a URL/name of the Team Project Collection to connect to, or a previously initialized TfsTeamProjectCollection object.
When using a URL, it must be fully qualified. The format of this string is as follows:
http[s]://<ComputerName>:<Port>/[<TFS-vDir>/]<CollectionName>
Valid values for the Transport segment of the URI are HTTP and HTTPS. If you specify a connection URI with a Transport segment, but do not specify a port, the session is created with standards ports: 80 for HTTP and 443 for HTTPS.
To connect to a Team Project Collection by using its name, a TfsConfigurationServer object must be supplied either via -Server argument or via a previous call to the Connect-TfsConfigurationServer cmdlet.
For more details, see the Get-TfsTeamProjectCollection cmdlet.
#>
Function Get-TfsArea
{
[CmdletBinding()]
[OutputType([Microsoft.TeamFoundation.Server.NodeInfo])]
Param
(
[Parameter(Position=0)]
[Alias("Path")]
[ValidateScript({($_ -is [string]) -or ($_ -is [uri]) -or ($_ -is [Microsoft.TeamFoundation.Server.NodeInfo])})]
[SupportsWildcards()]
[object]
$Area = '\**',
[Parameter(ValueFromPipeline=$true)]
[object]
$Project,
[Parameter()]
[object]
$Collection
)
Process
{
return _GetCssNodes -Node $Area -Scope Area -Project $Project -Collection $Collection
}
}
<#
.SYNOPSIS
Gets one or more Iterations ("Iteration Paths") from a given Team Project.
.PARAMETER Iteration
Specifies the name, URI or path of an Iteration. Wildcards are permitted. If omitted, all Iterations in the given Team Project are returned.
To supply a path, use a backslash ("\") between the path segments. Leading and trailing backslashes are optional.
When supplying a URI, use URIs in the form of "vstfs:///Classification/Node/<GUID>" (where <GUID> is the unique identifier of the given node)
.PARAMETER Project
Specifies either the name of the Team Project or a previously initialized Microsoft.TeamFoundation.WorkItemTracking.Client.Project object to connect to. If omitted, it defaults to the connection opened by Connect-TfsTeamProject (if any).
For more details, see the Get-TfsTeamProject cmdlet.
.PARAMETER Collection
Specifies either a URL/name of the Team Project Collection to connect to, or a previously initialized TfsTeamProjectCollection object.
When using a URL, it must be fully qualified. The format of this string is as follows:
http[s]://<ComputerName>:<Port>/[<TFS-vDir>/]<CollectionName>
Valid values for the Transport segment of the URI are HTTP and HTTPS. If you specify a connection URI with a Transport segment, but do not specify a port, the session is created with standards ports: 80 for HTTP and 443 for HTTPS.
To connect to a Team Project Collection by using its name, a TfsConfigurationServer object must be supplied either via -Server argument or via a previous call to the Connect-TfsConfigurationServer cmdlet.
For more details, see the Get-TfsTeamProjectCollection cmdlet.
#>
Function Get-TfsIteration
{
[CmdletBinding()]
[OutputType([Microsoft.TeamFoundation.Server.NodeInfo])]
Param
(
[Parameter(Position=0)]
[Alias("Path")]
[ValidateScript({($_ -is [string]) -or ($_ -is [uri]) -or ($_ -is [Microsoft.TeamFoundation.Server.NodeInfo])})]
[SupportsWildcards()]
[object]
$Iteration = '\**',
[Parameter(ValueFromPipeline=$true)]
[object]
$Project,
[Parameter()]
[object]
$Collection
)
Process
{
return _GetCssNodes -Node $Iteration -Scope Iteration -Project $Project -Collection $Collection
}
}
<#
.SYNOPSIS
Moves an Area from its parent area to another one in the same Team Project.
.PARAMETER Area
Specifies the name, URI or path of an Area. Wildcards are permitted. If omitted, all Areas in the given Team Project are returned.
To supply a path, use a backslash ("\") between the path segments. Leading and trailing backslashes are optional.
When supplying a URI, use URIs in the form of "vstfs:///Classification/Node/<GUID>" (where <GUID> is the unique identifier of the given node)
.PARAMETER Project
Specifies either the name of the Team Project or a previously initialized Microsoft.TeamFoundation.WorkItemTracking.Client.Project object to connect to. If omitted, it defaults to the connection opened by Connect-TfsTeamProject (if any).
For more details, see the Get-TfsTeamProject cmdlet.
.PARAMETER Collection
Specifies either a URL/name of the Team Project Collection to connect to, or a previously initialized TfsTeamProjectCollection object.
When using a URL, it must be fully qualified. The format of this string is as follows:
http[s]://<ComputerName>:<Port>/[<TFS-vDir>/]<CollectionName>
Valid values for the Transport segment of the URI are HTTP and HTTPS. If you specify a connection URI with a Transport segment, but do not specify a port, the session is created with standards ports: 80 for HTTP and 443 for HTTPS.
To connect to a Team Project Collection by using its name, a TfsConfigurationServer object must be supplied either via -Server argument or via a previous call to the Connect-TfsConfigurationServer cmdlet.
For more details, see the Get-TfsTeamProjectCollection cmdlet.
#>
Function Move-TfsArea
{
[CmdletBinding()]
Param
(
[Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)]
[Alias("Path")]
[ValidateScript({($_ -is [string]) -or ($_ -is [uri]) -or ($_ -is [Microsoft.TeamFoundation.Server.NodeInfo])})]
[object]
$Area,
[Parameter(Position=1l)]
[ValidateScript({($_ -is [string]) -or ($_ -is [uri]) -or ($_ -is [Microsoft.TeamFoundation.Server.NodeInfo])})]
[object]
$Destination,
[Parameter()]
[object]
$Project,
[Parameter()]
[object]
$Collection
)
Process
{
$node = Get-TfsArea -Area $Area -Project $Project -Collection $Collection
if (-not $node)
{
throw "Invalid or non-existent area $Area"
}
$destinationNode = Get-TfsArea -Area $Destination -Project $Project -Collection $Collection
if (-not $node)
{
throw "Invalid or non-existent destination area $Destination"
}
$cssService = _GetCssService -Project $Project -Collection $Collection
$cssService.MoveBranch($node.Uri, $destinationNode.Uri)
return $cssService.GetNode($node.Uri)
}
}
<#
.SYNOPSIS
Moves an Iteration from its parent iteration to another one in the same Team Project.
.PARAMETER Iteration
Specifies the name, URI or path of an Iteration. Wildcards are permitted. If omitted, all Iterations in the given Team Project are returned.
To supply a path, use a backslash ("\") between the path segments. Leading and trailing backslashes are optional.
When supplying a URI, use URIs in the form of "vstfs:///Classification/Node/<GUID>" (where <GUID> is the unique identifier of the given node)
.PARAMETER Project
Specifies either the name of the Team Project or a previously initialized Microsoft.TeamFoundation.WorkItemTracking.Client.Project object to connect to. If omitted, it defaults to the connection opened by Connect-TfsTeamProject (if any).
For more details, see the Get-TfsTeamProject cmdlet.
.PARAMETER Collection
Specifies either a URL/name of the Team Project Collection to connect to, or a previously initialized TfsTeamProjectCollection object.
When using a URL, it must be fully qualified. The format of this string is as follows:
http[s]://<ComputerName>:<Port>/[<TFS-vDir>/]<CollectionName>
Valid values for the Transport segment of the URI are HTTP and HTTPS. If you specify a connection URI with a Transport segment, but do not specify a port, the session is created with standards ports: 80 for HTTP and 443 for HTTPS.
To connect to a Team Project Collection by using its name, a TfsConfigurationServer object must be supplied either via -Server argument or via a previous call to the Connect-TfsConfigurationServer cmdlet.
For more details, see the Get-TfsTeamProjectCollection cmdlet.
#>
Function Move-TfsIteration
{
[CmdletBinding()]
Param
(
[Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)]
[Alias("Path")]
[ValidateScript({($_ -is [string]) -or ($_ -is [uri]) -or ($_ -is [Microsoft.TeamFoundation.Server.NodeInfo])})]
[object]
$Iteration,
[Parameter(Position=1)]
[ValidateScript({($_ -is [string]) -or ($_ -is [uri]) -or ($_ -is [Microsoft.TeamFoundation.Server.NodeInfo])})]
[object]
$Destination,
[Parameter()]
[object]
$Project,
[Parameter()]
[object]
$Collection
)
Process
{
$node = Get-TfsIteration -Iteration $Iteration -Project $Project -Collection $Collection
if (-not $node)
{
throw "Invalid or non-existent iteration $Iteration"
}
$destinationNode = Get-TfsIteration -Iteration $Destination -Project $Project -Collection $Collection
if (-not $node)
{
throw "Invalid or non-existent destination iteration $Destination"
}
$cssService = _GetCssService -Project $Project -Collection $Collection
$cssService.MoveBranch($node.Uri, $destinationNode.Uri)
return $cssService.GetNode($node.Uri)
}
}
<#
.SYNOPSIS
Create a new Area ("Area Path") in the given Team Project.
.PARAMETER Area
Specifies the path of the new Area.
When supplying a path, use a backslash ("\") between the path segments. Leading and trailing backslashes are optional. The last segment in the path will be the area name.
.PARAMETER Project
Specifies either the name of the Team Project or a previously initialized Microsoft.TeamFoundation.WorkItemTracking.Client.Project object to connect to. If omitted, it defaults to the connection opened by Connect-TfsTeamProject (if any).
For more details, see the Get-TfsTeamProject cmdlet.
.PARAMETER Collection
Specifies either a URL/name of the Team Project Collection to connect to, or a previously initialized TfsTeamProjectCollection object.
When using a URL, it must be fully qualified. The format of this string is as follows:
http[s]://<ComputerName>:<Port>/[<TFS-vDir>/]<CollectionName>
Valid values for the Transport segment of the URI are HTTP and HTTPS. If you specify a connection URI with a Transport segment, but do not specify a port, the session is created with standards ports: 80 for HTTP and 443 for HTTPS.
To connect to a Team Project Collection by using its name, a TfsConfigurationServer object must be supplied either via -Server argument or via a previous call to the Connect-TfsConfigurationServer cmdlet.
For more details, see the Get-TfsTeamProjectCollection cmdlet.
#>
Function New-TfsArea
{
[CmdletBinding()]
Param
(
[Parameter(Mandatory=$true, Position=0)]
[Alias("Path")]
[string]
$Area,
[Parameter()]
[object]
$Project,
[Parameter()]
[object]
$Collection
)
Process
{
return _NewCssNode -Path $Area -Scope Area -Project $Project -Collection $Collection
}
}
<#
.SYNOPSIS
Create a new Iteration ("Iteration Path") in the given Team Project.
.PARAMETER Area
Specifies the path of the new Iteration.
When supplying a path, use a backslash ("\") between the path segments. Leading and trailing backslashes are optional. The last segment in the path will be the iteration name.
.PARAMETER Project
Specifies either the name of the Team Project or a previously initialized Microsoft.TeamFoundation.WorkItemTracking.Client.Project object to connect to. If omitted, it defaults to the connection opened by Connect-TfsTeamProject (if any).
For more details, see the Get-TfsTeamProject cmdlet.
.PARAMETER Collection
Specifies either a URL/name of the Team Project Collection to connect to, or a previously initialized TfsTeamProjectCollection object.
When using a URL, it must be fully qualified. The format of this string is as follows:
http[s]://<ComputerName>:<Port>/[<TFS-vDir>/]<CollectionName>
Valid values for the Transport segment of the URI are HTTP and HTTPS. If you specify a connection URI with a Transport segment, but do not specify a port, the session is created with standards ports: 80 for HTTP and 443 for HTTPS.
To connect to a Team Project Collection by using its name, a TfsConfigurationServer object must be supplied either via -Server argument or via a previous call to the Connect-TfsConfigurationServer cmdlet.
For more details, see the Get-TfsTeamProjectCollection cmdlet.
#>
Function New-TfsIteration
{
[CmdletBinding()]
Param
(
[Parameter(Mandatory=$true, Position=0)]
[ValidateScript({($_ -is [string]) -or ($_ -is [Microsoft.TeamFoundation.Server.NodeInfo])})]
[Alias("Path")]
[object]
$Iteration,
[Parameter()]
[DateTime]
$StartDate,
[Parameter()]
[DateTime]
$FinishDate,
[Parameter()]
[object]
$Project,
[Parameter()]
[object]
$Collection
)
Process
{
return _NewCssNode -Path $Iteration -Scope Iteration -Project $Project -Collection $Collection -StartDate $StartDate -FinishDate $FinishDate
}
}
<#
.SYNOPSIS
Deletes one or more Areas ("Area Path").
.PARAMETER Area
Specifies the name, URI or path of an Area. Wildcards are permitted. If omitted, all Areas in the given Team Project are returned.
To supply a path, use a backslash ("\") between the path segments. Leading and trailing backslashes are optional.
When supplying a URI, use URIs in the form of "vstfs:///Classification/Node/<GUID>" (where <GUID> is the unique identifier of the given node)
.PARAMETER Project
Specifies either the name of the Team Project or a previously initialized Microsoft.TeamFoundation.WorkItemTracking.Client.Project object to connect to. If omitted, it defaults to the connection opened by Connect-TfsTeamProject (if any).
For more details, see the Get-TfsTeamProject cmdlet.
.PARAMETER Collection
Specifies either a URL/name of the Team Project Collection to connect to, or a previously initialized TfsTeamProjectCollection object.
When using a URL, it must be fully qualified. The format of this string is as follows:
http[s]://<ComputerName>:<Port>/[<TFS-vDir>/]<CollectionName>
Valid values for the Transport segment of the URI are HTTP and HTTPS. If you specify a connection URI with a Transport segment, but do not specify a port, the session is created with standards ports: 80 for HTTP and 443 for HTTPS.
To connect to a Team Project Collection by using its name, a TfsConfigurationServer object must be supplied either via -Server argument or via a previous call to the Connect-TfsConfigurationServer cmdlet.
For more details, see the Get-TfsTeamProjectCollection cmdlet.
#>
Function Remove-TfsArea
{
[CmdletBinding(ConfirmImpact='High', SupportsShouldProcess=$true)]
Param
(
[Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)]
[Alias("Path")]
[ValidateScript({($_ -is [string]) -or ($_ -is [Microsoft.TeamFoundation.Server.NodeInfo])})]
[object]
$Area,
[Parameter(Position=1)]
[Alias("NewPath")]
[ValidateScript({ ($_ -is [string]) -or ($_ -is [Microsoft.TeamFoundation.Server.NodeInfo]) })]
[object]
$MoveTo = '\',
[Parameter()]
[object]
$Project,
[Parameter()]
[object]
$Collection
)
Process
{
$Areas = Get-TfsArea -Area $Area -Project $Project -Collection $Collection | Sort -Property Path -Descending
foreach($i in $Areas)
{
if ($PSCmdlet.ShouldProcess($i.RelativePath, "Delete Area"))
{
$projectName = $i.Path.Split("\")[1]
_DeleteCssNode -Node $i -MoveToNode $MoveTo -Scope Area -Project $projectName -Collection $Collection
}
}
}
}
<#
.SYNOPSIS
Deletes one or more Iterations ("Iteration Paths").
.PARAMETER Area
Specifies the name, URI or path of an Iteration. Wildcards are permitted. If omitted, all Iterations in the given Team Project are returned.
To supply a path, use a backslash ("\") between the path segments. Leading and trailing backslashes are optional.
When supplying a URI, use URIs in the form of "vstfs:///Classification/Node/<GUID>" (where <GUID> is the unique identifier of the given node)
.PARAMETER Project
Specifies either the name of the Team Project or a previously initialized Microsoft.TeamFoundation.WorkItemTracking.Client.Project object to connect to. If omitted, it defaults to the connection opened by Connect-TfsTeamProject (if any).
For more details, see the Get-TfsTeamProject cmdlet.
.PARAMETER Collection
Specifies either a URL/name of the Team Project Collection to connect to, or a previously initialized TfsTeamProjectCollection object.
When using a URL, it must be fully qualified. The format of this string is as follows:
http[s]://<ComputerName>:<Port>/[<TFS-vDir>/]<CollectionName>
Valid values for the Transport segment of the URI are HTTP and HTTPS. If you specify a connection URI with a Transport segment, but do not specify a port, the session is created with standards ports: 80 for HTTP and 443 for HTTPS.
To connect to a Team Project Collection by using its name, a TfsConfigurationServer object must be supplied either via -Server argument or via a previous call to the Connect-TfsConfigurationServer cmdlet.
For more details, see the Get-TfsTeamProjectCollection cmdlet.
#>
Function Remove-TfsIteration
{
[CmdletBinding(ConfirmImpact='High', SupportsShouldProcess=$true)]
Param
(
[Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)]
[Alias("Path")]
[ValidateScript({($_ -is [string]) -or ($_ -is [Microsoft.TeamFoundation.Server.NodeInfo])})]
[object]
$Iteration,
[Parameter(Position=1)]
[Alias("NewPath")]
[ValidateScript({ ($_ -is [string]) -or ($_ -is [Microsoft.TeamFoundation.Server.NodeInfo]) })]
[object]
$MoveTo = '\',
[Parameter()]
[object]
$Project,
[Parameter()]
[object]
$Collection
)
Process
{
$iterations = Get-TfsIteration -Iteration $Iteration -Project $Project -Collection $Collection | Sort -Property Path -Descending
foreach($i in $iterations)
{
if ($PSCmdlet.ShouldProcess($i.RelativePath, "Delete Iteration"))
{
$projectName = $i.Path.Split("\")[1]
_DeleteCssNode -Node $i -MoveToNode $MoveTo -Scope Iteration -Project $Project -Collection $Collection
}
}
}
}
<#
.SYNOPSIS
Renames an Area ("Area Path")
.PARAMETER Area
Specifies the name, URI or path of an Area. Wildcards are permitted. If omitted, all Areas in the given Team Project are returned.
To supply a path, use a backslash ("\") between the path segments. Leading and trailing backslashes are optional.
When supplying a URI, use URIs in the form of "vstfs:///Classification/Node/<GUID>" (where <GUID> is the unique identifier of the given node)
.PARAMETER NewName
Specifies the new name of the area. Enter only a name, not a path and name. If you enter a path that is different from the path that is specified in the Area parameter, Rename-TfsArea generates an error. To rename and move an item, use the Move-TfsArea cmdlet.
.PARAMETER Project
Specifies either the name of the Team Project or a previously initialized Microsoft.TeamFoundation.WorkItemTracking.Client.Project object to connect to. If omitted, it defaults to the connection opened by Connect-TfsTeamProject (if any).
For more details, see the Get-TfsTeamProject cmdlet.
.PARAMETER Collection
Specifies either a URL/name of the Team Project Collection to connect to, or a previously initialized TfsTeamProjectCollection object.
When using a URL, it must be fully qualified. The format of this string is as follows:
http[s]://<ComputerName>:<Port>/[<TFS-vDir>/]<CollectionName>
Valid values for the Transport segment of the URI are HTTP and HTTPS. If you specify a connection URI with a Transport segment, but do not specify a port, the session is created with standards ports: 80 for HTTP and 443 for HTTPS.
To connect to a Team Project Collection by using its name, a TfsConfigurationServer object must be supplied either via -Server argument or via a previous call to the Connect-TfsConfigurationServer cmdlet.
For more details, see the Get-TfsTeamProjectCollection cmdlet.
#>
Function Rename-TfsArea
{
[CmdletBinding()]
Param
(
[Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)]
[ValidateScript({($_ -is [string]) -or ($_ -is [Microsoft.TeamFoundation.Server.NodeInfo])})]
[Alias("Path")]
[object]
$Area,
[Parameter(Position=1)]
[string]
$NewName,
[Parameter()]
[object]
$Project,
[Parameter()]
[object]
$Collection
)
Process
{
Set-TfsArea -Area $Area -NewName $NewName -Project $Project -Collection $Collection
}
}
<#
.SYNOPSIS
Renames an Iteration ("Iteration Path").
.PARAMETER Iteration
Specifies the name, URI or path of an Iteration. Wildcards are permitted. If omitted, all Iterations in the given Team Project are returned.
To supply a path, use a backslash ("\") between the path segments. Leading and trailing backslashes are optional.
When supplying a URI, use URIs in the form of "vstfs:///Classification/Node/<GUID>" (where <GUID> is the unique identifier of the given node)
.PARAMETER NewName
Specifies the new name of the iteration. Enter only a name, not a path and name. If you enter a path that is different from the path that is specified in the Iteration parameter, Rename-TfsIteration generates an error. To rename and move an item, use the Move-TfsIteration cmdlet.
.PARAMETER Project
Specifies either the name of the Team Project or a previously initialized Microsoft.TeamFoundation.WorkItemTracking.Client.Project object to connect to. If omitted, it defaults to the connection opened by Connect-TfsTeamProject (if any).
For more details, see the Get-TfsTeamProject cmdlet.
.PARAMETER Collection
Specifies either a URL/name of the Team Project Collection to connect to, or a previously initialized TfsTeamProjectCollection object.
When using a URL, it must be fully qualified. The format of this string is as follows:
http[s]://<ComputerName>:<Port>/[<TFS-vDir>/]<CollectionName>
Valid values for the Transport segment of the URI are HTTP and HTTPS. If you specify a connection URI with a Transport segment, but do not specify a port, the session is created with standards ports: 80 for HTTP and 443 for HTTPS.
To connect to a Team Project Collection by using its name, a TfsConfigurationServer object must be supplied either via -Server argument or via a previous call to the Connect-TfsConfigurationServer cmdlet.
For more details, see the Get-TfsTeamProjectCollection cmdlet.
#>
Function Rename-TfsIteration
{
[CmdletBinding()]
Param
(
[Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)]
[ValidateScript({($_ -is [string]) -or ($_ -is [Microsoft.TeamFoundation.Server.NodeInfo])})]
[Alias("Path")]
[object]
$Iteration,
[Parameter(Position=1)]
[string]
$NewName,
[Parameter()]
[object]
$Project,
[Parameter()]
[object]
$Collection
)
Process
{
Set-TfsIteration -Iteration $Iteration -NewName $NewName -Project $Project -Collection $Collection
}
}
<#
.SYNOPSIS
Changes the value of a property of an Area.
.PARAMETER Area
Specifies the name, URI or path of an Area. Wildcards are permitted. If omitted, all Areas in the given Team Project are returned.
To supply a path, use a backslash ("\") between the path segments. Leading and trailing backslashes are optional.
When supplying a URI, use URIs in the form of "vstfs:///Classification/Node/<GUID>" (where <GUID> is the unique identifier of the given node)
.PARAMETER NewName
Specifies the new name of the area. Enter only a name, not a path and name. If you enter a path that is different from the path that is specified in the area parameter, Rename-Tfsarea generates an error. To rename and move an item, use the Move-Tfsarea cmdlet.
.PARAMETER MoveBy
Reorders an area by moving it either up or down inside its parent. A positive value moves an area down, whereas a negative one moves it up.
.PARAMETER Project
Specifies either the name of the Team Project or a previously initialized Microsoft.TeamFoundation.WorkItemTracking.Client.Project object to connect to. If omitted, it defaults to the connection opened by Connect-TfsTeamProject (if any).
For more details, see the Get-TfsTeamProject cmdlet.
.PARAMETER Collection
Specifies either a URL/name of the Team Project Collection to connect to, or a previously initialized TfsTeamProjectCollection object.
When using a URL, it must be fully qualified. The format of this string is as follows:
http[s]://<ComputerName>:<Port>/[<TFS-vDir>/]<CollectionName>
Valid values for the Transport segment of the URI are HTTP and HTTPS. If you specify a connection URI with a Transport segment, but do not specify a port, the session is created with standards ports: 80 for HTTP and 443 for HTTPS.
To connect to a Team Project Collection by using its name, a TfsConfigurationServer object must be supplied either via -Server argument or via a previous call to the Connect-TfsConfigurationServer cmdlet.
For more details, see the Get-TfsTeamProjectCollection cmdlet.
#>
Function Set-TfsArea
{
[CmdletBinding()]
Param
(
[Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)]
[ValidateScript({($_ -is [string]) -or ($_ -is [Microsoft.TeamFoundation.Server.NodeInfo])})]
[Alias("Path")]
[object]
$Area,
[Parameter()]
[string]
$NewName,
[Parameter()]
[int]
$MoveBy,
[Parameter()]
[object]
$Project,
[Parameter()]
[object]
$Collection
)
Process
{
$node = Get-TfsArea -Area $Area -Project $Project -Collection $Collection
if (-not $node)
{
throw "Invalid or non-existent area $Area"
}
$cssService = _GetCssService -Project $Project -Collection $Collection
if ($NewName)
{
$cssService.RenameNode($node.Uri, $NewName)
}
if ($MoveBy)
{
$cssService.ReorderNode($node.Uri, $MoveBy)
}
return $cssService.GetNode($node.Uri)
}
}
<#
.SYNOPSIS
Changes the value of a property of an Iteration.
.PARAMETER Iteration
Specifies the name, URI or path of an Iteration. Wildcards are permitted. If omitted, all Iterations in the given Team Project are returned.
To supply a path, use a backslash ("\") between the path segments. Leading and trailing backslashes are optional.
When supplying a URI, use URIs in the form of "vstfs:///Classification/Node/<GUID>" (where <GUID> is the unique identifier of the given node)
.PARAMETER NewName
Specifies the new name of the iteration. Enter only a name, not a path and name. If you enter a path that is different from the path that is specified in the Iteration parameter, Rename-TfsIteration generates an error. To rename and move an item, use the Move-TfsIteration cmdlet.
.PARAMETER MoveBy
Reorders an iteration by moving it either up or down inside its parent. A positive value moves an iteration down, whereas a negative one moves it up.
.PARAMETER StartDate
Sets the start date of the iteration. To clear the start date, set it to $null. Note that when clearing a date, both must be cleared at the same time (i.e. setting both StartDate and FinishDate to $null)
.PARAMETER FinishDate
Sets the finish date of the iteration. To clear the finish date, set it to $null. Note that when clearing a date, both must be cleared at the same time (i.e. setting both StartDate and FinishDate to $null)
.PARAMETER Project
Specifies either the name of the Team Project or a previously initialized Microsoft.TeamFoundation.WorkItemTracking.Client.Project object to connect to. If omitted, it defaults to the connection opened by Connect-TfsTeamProject (if any).
For more details, see the Get-TfsTeamProject cmdlet.
.PARAMETER Collection
Specifies either a URL/name of the Team Project Collection to connect to, or a previously initialized TfsTeamProjectCollection object.
When using a URL, it must be fully qualified. The format of this string is as follows:
http[s]://<ComputerName>:<Port>/[<TFS-vDir>/]<CollectionName>
Valid values for the Transport segment of the URI are HTTP and HTTPS. If you specify a connection URI with a Transport segment, but do not specify a port, the session is created with standards ports: 80 for HTTP and 443 for HTTPS.
To connect to a Team Project Collection by using its name, a TfsConfigurationServer object must be supplied either via -Server argument or via a previous call to the Connect-TfsConfigurationServer cmdlet.
For more details, see the Get-TfsTeamProjectCollection cmdlet.
#>
Function Set-TfsIteration
{
[CmdletBinding()]
Param
(
[Parameter(Position=0, Mandatory=$true, ValueFromPipeline=$true)]
[Alias("Path")]
[ValidateScript({($_ -is [string]) -or ($_ -is [Microsoft.TeamFoundation.Server.NodeInfo])})]
[object]
$Iteration = '\**',
[Parameter()]
[string]
$NewName,
[Parameter()]
[int]
$MoveBy,
[Parameter()]
[Nullable[DateTime]]
$StartDate,
[Parameter()]
[Nullable[DateTime]]
$FinishDate,
[Parameter()]
[object]
$Project,
[Parameter()]
[object]
$Collection
)
Process
{
$node = Get-TfsIteration -Iteration $Iteration -Project $Project -Collection $Collection
if (-not $node)
{
throw "Invalid or non-existent iteration $Iteration"
}
$cssService = _GetCssService -Project $Project -Collection $Collection
$cssService4 = _GetCssService -Project $Project -Collection $Collection -Version 4
if ($NewName)
{
$cssService.RenameNode($node.Uri, $NewName)
}
if ($MoveBy)
{
$cssService.ReorderNode($node.Uri, $MoveBy)
}
if ($StartDate -or $FinishDate)
{
if (-not $PSBoundParameters.ContainsKey("StartDate"))
{
$StartDate = $node.StartDate
}
if (-not $PSBoundParameters.ContainsKey("FinishDate"))
{
$FinishDate = $node.FinishDate
}
[void]$cssService4.SetIterationDates($node.Uri, $StartDate, $FinishDate)
}
return $cssService.GetNode($node.Uri)
}
}
Function _GetCssNodes($Node, $Scope, $Project, $Collection)
{
Process
{
if ($Node -is [Microsoft.TeamFoundation.Server.NodeInfo])
{
return $Node
}
$tp = Get-TfsTeamProject -Project $Project -Collection $Collection
$tpc = $tp.Store.TeamProjectCollection
$projectName = $tp.Name
$cssService = $tpc.GetService([type]"Microsoft.TeamFoundation.Server.ICommonStructureService")
if ($node -is [uri])
{
return $cssService.GetNode($node)
}
$rootPath = _NormalizePath "$projectName\$Scope"
$fullPath = _NormalizePath "$rootPath\$Node"
$rootNodeUri = $cssService.GetNodeFromPath("$rootPath").Uri
$rootElement = $cssService.GetNodesXml(@($rootNodeUri), $true)
$nodePaths = $rootElement.SelectNodes('//@Path') | Select -ExpandProperty '#text'
$matchingPaths = $nodePaths | ? { $_ -like $fullPath }
return $matchingPaths | % { $cssService.GetNodeFromPath($_) }
}
}
Function _DeleteCssNode($Node, $Scope, $MoveToNode, $Project, $Collection)
{
Process
{
$newNode = _GetCssNodes -Node $MoveToNode -Scope $Scope -Project $Project -Collection $Collection
$cssService = _GetCssService -Project $Project -Collection $Collection
$cssService.DeleteBranches($Node.Uri, $newNode.Uri)
}
}
Function _NewCssNode ($Project, $Path, $Scope, $Collection, $StartDate, $FinishDate)
{
Process
{
$tp = Get-TfsTeamProject -Project $Project -Collection $Collection
$tpc = $tp.Store.TeamProjectCollection
$projectName = $tp.Name
$cssService = $tpc.GetService([type]"Microsoft.TeamFoundation.Server.ICommonStructureService")
try
{
$fullPath = _NormalizePath "$projectName\$Scope\$Path"
$parentPath = Split-Path $fullPath -Parent
$nodeName = Split-Path $fullPath -Leaf
$parentNode = $cssService.GetNodeFromPath($parentPath)
}
catch
{
$parentNode = _NewCssNode -Project $Project -Path $parentPath -Scope $Scope -Collection $Collection
}
if ($StartDate -or $FinishDate)
{
$cssService = $tpc.GetService([type]"Microsoft.TeamFoundation.Server.ICommonStructureService4")
$nodeUri = $cssService.CreateNode($nodeName, $parentNode.Uri, $StartDate, $FinishDate)
}
else
{
$nodeUri = $cssService.CreateNode($nodeName, $parentNode.Uri)
}
return $cssService.GetNode($nodeUri)
}
}
Function _NormalizePath($Path)
{
if([string]::IsNullOrWhiteSpace($Path))
{
return [string]::Empty
}
$newPath = [System.Text.RegularExpressions.Regex]::Replace($Path, '\\{2,}', '\')
if (-not $newPath.StartsWith("\"))
{
$newPath = "\$newPath"
}
if ($newPath.EndsWith("\"))
{
$newPath = $newPath.Substring(0, $newPath.Length-1)
}
return $newPath
}
Function _GetCssService($Project, $Collection, $Version)
{
$tp = Get-TfsTeamProject -Project $Project -Collection $Collection
$tpc = $tp.Store.TeamProjectCollection
$projectName = $tp.Name
return $tpc.GetService([type]"Microsoft.TeamFoundation.Server.ICommonStructureService$Version")
}
$InstallPath = Join-Path $($env:ChocolateyInstall) 'lib\TfsCmdlets'
$ToolsDir = Join-Path $InstallPath 'Tools'
if ($env:PSModulePath -contains $ToolsDir)
{
[Environment]::SetEnvironmentVariable("PSModulePath", ($env:PSModulePath -replace ";$ToolDir",''), 'Machine')
}
<#
.SYNOPSIS
Gets information about a configuration server.
#>
Function Get-TfsConfigurationServer
{
[CmdletBinding(DefaultParameterSetName='Get by server')]
[OutputType([Microsoft.TeamFoundation.Client.TfsConfigurationServer])]
Param
(
[Parameter(Position=0, ParameterSetName='Get by server', Mandatory=$true)]
[AllowNull()]
[object]
$Server,
[Parameter(Position=0, ParameterSetName="Get current")]
[switch]
$Current,
[Parameter(Position=1, ParameterSetName='Get by server')]
[System.Management.Automation.Credential()]
[System.Management.Automation.PSCredential]
$Credential = [System.Management.Automation.PSCredential]::Empty
)
Process
{
if ($Current)
{
return $Global:TfsServerConnection
}
if ($Server -is [Microsoft.TeamFoundation.Client.TfsConfigurationServer])
{
return $Server
}
if ($Server -is [Uri])
{
return _GetConfigServerFromUrl $Server $Credential
}
if ($Server -is [string])
{
if ([Uri]::IsWellFormedUriString($Server, [UriKind]::Absolute))
{
return _GetConfigServerFromUrl ([Uri] $Server) $Credential
}
if (-not [string]::IsNullOrWhiteSpace($Server))
{
return _GetConfigServerFromName $Server $Credential
}
}
if ($Server -eq $null)
{
if ($Global:TfsServerConnection)
{
return $Global:TfsServerConnection
}
}
throw "No TFS connection information available. Either supply a valid -Server argument or use Connect-TfsConfigurationServer prior to invoking this cmdlet."
}
}
# =================
# Helper Functions
# =================
Function _GetConfigServerFromUrl
{
Param ($Url, $Cred)
if ($Cred -ne [System.Management.Automation.PSCredential]::Empty)
{
return New-Object Microsoft.TeamFoundation.Client.TfsConfigurationServer -ArgumentList ([Uri] $Url), (_GetCredential $cred)
}
return [Microsoft.TeamFoundation.Client.TfsConfigurationServerFactory]::GetConfigurationServer([Uri] $Url)
}
Function _GetConfigServerFromName
{
Param ($Name, $Cred)
$Servers = Get-TfsRegisteredConfigurationServer $Name
foreach($Server in $Servers)
{
if ($Cred -ne [System.Management.Automation.PSCredential]::Empty)
{
$configServer = New-Object Microsoft.TeamFoundation.Client.TfsConfigurationServer -ArgumentList $Server.Uri, (_GetCredential $cred)
}
else
{
$configServer = [Microsoft.TeamFoundation.Client.TfsConfigurationServerFactory]::GetConfigurationServer($Server)
}
$configServer.EnsureAuthenticated()
$configServer
}
}
Function _GetCredential
{
Param ($Cred)
if ($Cred)
{
return [System.Net.NetworkCredential] $Cred
}
return [System.Net.CredentialCache]::DefaultNetworkCredentials
}
<#
.SYNOPSIS
Gets the configuration server database connection string.
#>
Function Get-TfsConfigurationServerConnectionString
{
[CmdletBinding()]
[OutputType([string])]
Param
(
[Parameter()]
[string]
[Alias('Session')]
$Computer,
[Parameter()]
[string]
$Version = '12.0',
[Parameter()]
[System.Management.Automation.Credential()]
[System.Management.Automation.PSCredential]
$Credential = [System.Management.Automation.PSCredential]::Empty
)
Process
{
$scriptBlock = New-ScriptBlock -EntryPoint '_GetConnectionString' -Dependency 'Get-InstallationPath', 'Test-RegistryValue', 'Get-RegistryValue'
return Invoke-ScriptBlock -ScriptBlock $scriptBlock -Computer $Computer -Credential $Credential -ArgumentList $Version
}
}
Function _GetConnectionString($Version)
{
$path = Get-InstallationPath -Version $Version -Component ApplicationTier
$webConfigPath = Join-Path $path 'Web Services\Web.config'
$webConfig = [xml] (Get-Content $webConfigPath)
return (Select-Xml -Xml $webConfig -XPath '/configuration/appSettings/add[@key="applicationDatabase"]/@value').Node.Value
}
<#
.SYNOPSIS
Gets one or more Team Foundation Server addresses registered in the current computer.
#>
Function Get-TfsRegisteredConfigurationServer
{
[CmdletBinding()]
[OutputType([Microsoft.TeamFoundation.Client.RegisteredConfigurationServer[]])]
Param
(
[Parameter(Position=0, ValueFromPipeline=$true)]
[string]
$Name = "*"
)
Process
{
if(($Name -eq "localhost") -or ($Name -eq "."))
{
$Name = $env:COMPUTERNAME
}
return [Microsoft.TeamFoundation.Client.RegisteredTfsConnections]::GetConfigurationServers() | ? Name -Like $Name
}
}
<#
.SYNOPSIS
Connects to a configuration server.
.PARAMETER Passthru
Returns the results of the command. By default, this cmdlet does not generate any output.
.DESCRIPTION
The Connect-TfsConfigurationServer function connects to a TFS configuration server. Functions that operate on a server level (as opposed to those operation on a team project collection level) will use by default a connection opened by this function.
.NOTES
A TFS Configuration Server represents the server that is running Team Foundation Server. On a database level, it is represented by the Tfs_Configuration database.
Operations that should be performed on a server level (such as setting server-level permissions) require a connection to a TFS configuration server.
Internally, this connection is represented by an instance of the Microsoft.TeamFoundation.Client.TfsConfigurationServer class and is kept in a PowerShell global variable caled TfsServerConnection .
#>
Function Connect-TfsConfigurationServer
{
[CmdletBinding()]
[OutputType([Microsoft.TeamFoundation.Client.TfsConfigurationServer])]
Param
(
[Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)]
[ValidateNotNull()]
[object]
$Server,
[Parameter(Position=1)]
[System.Management.Automation.Credential()]
[System.Management.Automation.PSCredential]
$Credential = [System.Management.Automation.PSCredential]::Empty,
[Parameter()]
[switch]
$Passthru
)
Process
{
$configServer = Get-TfsConfigurationServer -Server $Server -Credential $Credential
if (-not $configServer)
{
throw "Error connecting to TFS"
}
$Global:TfsTeamConnection = $null
$Global:TfsProjectConnection = $null
$Global:TfsTpcConnection = $null
$Global:TfsServerConnection = $configServer
if ($Passthru)
{
return $configServer
}
}
}
<#
.SYNOPSIS
Connects to a team project.
.PARAMETER Passthru
Returns the results of the command. By default, this cmdlet does not generate any output.
#>
Function Connect-TfsTeamProject
{
[CmdletBinding()]
[OutputType([Microsoft.TeamFoundation.WorkItemTracking.Client.Project])]
Param
(
[Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)]
[ValidateNotNull()]
[object]
$Project,
[Parameter()]
[object]
$Collection,
[Parameter()]
[System.Management.Automation.Credential()]
[System.Management.Automation.PSCredential]
$Credential = [System.Management.Automation.PSCredential]::Empty,
[Parameter()]
[switch]
$Passthru
)
Process
{
$tp = (Get-TfsTeamProject -Project $Project -Collection $Collection -Credential $Credential | Select -First 1)
if (-not $tp)
{
throw "Error connecting to team project $Project"
}
$Global:TfsTeamConnection = $null
$Global:TfsProjectConnection = $tp
$Global:TfsTpcConnection = $tp.Store.TeamProjectCollection
$Global:TfsServerConnection = $Global:TfsTpcConnection.ConfigurationServer
if ($Passthru)
{
return $tp
}
}
}
<#
.SYNOPSIS
Connects to a team project collection.
.DESCRIPTION
The Connect-TfsTeamProjectCollection cmdlet "connects" (initializes a Microsoft.TeamFoundation.Client.TfsTeamProjectCollection object) to a TFS Team Project Collection. That connection is subsequently kept in a global variable to be later reused until it's closed by a call to Disconnect-TfsTeamProjectCollection.
Most cmdlets in the TfsCmdlets module require a TfsTeamProjectCollection object to be provided via their -Collection argument in order to access a TFS instance. Those cmdlets will use the connection opened by Connect-TfsTeamProjectCollection as their "default connection". In other words, TFS cmdlets (e.g. New-TfsWorkItem) that have a -Collection argument will use the connection provided by Connect-TfsTeamProjectCollection by default.
.PARAMETER Collection
Specifies either a URL/name of the Team Project Collection to connect to, or a previously initialized TfsTeamProjectCollection object.
Finally, if a TfsTeamProjectCollection object is provided via this argument, it will be used as the new default connection. This may be especially useful if you e.g. received a pre-initialized connection to a TFS collection via a call to an external library or API.
For more details, see the -Collection argument in the Get-TfsTeamProjectCollection cmdlet.
.PARAMETER Server
Specifies either a URL or the name of the Team Foundation Server configuration server (the "root" of a TFS installation) to connect to, or a previously initialized Microsoft.TeamFoundation.Client.TfsConfigurationServer object.
For more details, see the -Server argument in the Get-TfsConfigurationServer cmdlet.
.PARAMETER Credential
Specifies a user account that has permission to perform this action. The default is the current user.
Type a user name, such as "User01" or "Domain01\User01", or enter a PSCredential object, such as one generated by the Get-Credential cmdlet. If you type a user name, you will be prompted for a password.
To connect to Visual Studio Online you must enable Alternate Credentials for your user profile and supply that credential in this argument.
For more information on Alternate Credentials for your Visual Studio Online account, please refer to https://msdn.microsoft.com/library/dd286572#setup_basic_auth.
.PARAMETER Passthru
Returns the results of the command. By default, this cmdlet does not generate any output.
.EXAMPLE
Connect-TfsTeamProjectCollection -Collection http://tfs:8080/tfs/DefaultCollection
Connects to a collection called "DefaultCollection" in a TF server called "tfs" using the default credentials of the logged-on user
.LINK
Get-TfsTeamProjectCollection
.LINK
https://msdn.microsoft.com/en-us/library/microsoft.teamfoundation.client.tfsteamprojectcollection.aspx
#>
Function Connect-TfsTeamProjectCollection
{
[CmdletBinding()]
[OutputType([Microsoft.TeamFoundation.Client.TfsTeamProjectCollection])]
Param
(
[Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)]
[ValidateNotNull()]
[object]
$Collection,
[Parameter()]
[object]
$Server,
[Parameter()]
[System.Management.Automation.Credential()]
[System.Management.Automation.PSCredential]
$Credential = [System.Management.Automation.PSCredential]::Empty,
[Parameter()]
[switch]
$Passthru
)
Process
{
$tpc = $null
try
{
$tpc = (Get-TfsTeamProjectCollection -Collection $Collection -Server $Server -Credential $Credential | Select -First 1)
$tpc.EnsureAuthenticated()
}
catch
{
throw "Error connecting to team project collection $Collection ($_)"
}
$Global:TfsTeamConnection = $null
$Global:TfsProjectConnection = $null
$Global:TfsTpcConnection = $tpc
$Global:TfsServerConnection = $tpc.ConfigurationServer
if ($Passthru)
{
return $tpc
}
}
}
<#
.SYNOPSIS
Disconnects from the currently connected configuration server.
.DESCRIPTION
The Disconnect-TfsConfigurationServer cmdlet removes the global variable set by Connect-TfsConfigurationServer. Therefore, cmdlets relying on a "default server" as provided by "Get-TfsConfigurationServer -Current" will no longer work after a call to this cmdlet, unless their -Server argument is provided or a new call to Connect-TfsConfigurationServer is made.
.EXAMPLE
Disconnect-TfsConfigurationServer
Disconnects from the currently connected TFS configuration server
#>
Function Disconnect-TfsConfigurationServer
{
Process
{
Disconnect-TfsTeamProjectCollection
if ($Global:TfsServerConnection)
{
Remove-Variable -Name TfsServerConnection -Scope Global
}
}
}
<#
.SYNOPSIS
Disconnects from the currently connected team project.
.DESCRIPTION
The Disconnect-TfsTeamProject cmdlet removes the global variable set by Connect-TfsTeamProject . Therefore, cmdlets relying on a "default project" as provided by "Get-TfsTeamProject -Current" will no longer work after a call to this cmdlet, unless their -Project argument is provided or a new call to Connect-TfsTeamProject is made.
.EXAMPLE
Disconnect-TfsTeamProject
Disconnects from the currently connected TFS team project
#>
Function Disconnect-TfsTeamProject
{
Process
{
if ($Global:TfsProjectConnection)
{
Remove-Variable -Name TfsProjectConnection -Scope Global
}
}
}
<#
.SYNOPSIS
Disconnects from the currently connected team project collection.
.DESCRIPTION
The Disconnect-TfsTeamProjectCollection cmdlet removes the global variable set by Connect-TfsTeamProjectCollection. Therefore, cmdlets relying on a "default collection" as provided by "Get-TfsTeamProjectCollection -Current" will no longer work after a call to this cmdlet, unless their -Collection argument is provided or a new call to Connect-TfsTeamProjectCollection is made.
.EXAMPLE
Disconnect-TfsTeamProjectCollection
Disconnects from the currently connected TFS team project collection
#>
Function Disconnect-TfsTeamProjectCollection
{
Process
{
Disconnect-TfsTeamProject
if ($Global:TfsTpcConnection)
{
Remove-Variable -Name TfsTpcConnection -Scope Global
}
}
}
<#
.SYNOPSIS
Renames a Git repository in a team project.
.PARAMETER Project
Specifies either the name of the Team Project or a previously initialized Microsoft.TeamFoundation.WorkItemTracking.Client.Project object to connect to. If omitted, it defaults to the connection opened by Connect-TfsTeamProject (if any).
For more details, see the Get-TfsTeamProject cmdlet.
.PARAMETER Collection
Specifies either a URL/name of the Team Project Collection to connect to, or a previously initialized TfsTeamProjectCollection object.
When using a URL, it must be fully qualified. The format of this string is as follows:
http[s]://<ComputerName>:<Port>/[<TFS-vDir>/]<CollectionName>
Valid values for the Transport segment of the URI are HTTP and HTTPS. If you specify a connection URI with a Transport segment, but do not specify a port, the session is created with standards ports: 80 for HTTP and 443 for HTTPS.
To connect to a Team Project Collection by using its name, a TfsConfigurationServer object must be supplied either via -Server argument or via a previous call to the Connect-TfsConfigurationServer cmdlet.
For more details, see the Get-TfsTeamProjectCollection cmdlet.
.PARAMETER Passthru
Returns the results of the command. By default, this cmdlet does not generate any output.
#>
Function Rename-TfsGitRepository
{
[CmdletBinding(SupportsShouldProcess=$true)]
[OutputType([Microsoft.TeamFoundation.SourceControl.WebApi.GitRepository])]
Param
(
[Parameter(Mandatory=$true, ValueFromPipeline=$true, Position=0)]
[object]
$Repository,
[Parameter(Mandatory=$true, Position=1)]
[string]
$NewName,
[Parameter()]
[object]
$Project,
[Parameter()]
[object]
$Collection,
[Parameter()]
[switch]
$Passthru
)
Begin
{
Add-Type -AssemblyName 'Microsoft.TeamFoundation.Core.WebApi'
Add-Type -AssemblyName 'Microsoft.TeamFoundation.SourceControl.WebApi'
}
Process
{
if ($Repository -is [Microsoft.TeamFoundation.SourceControl.WebApi.GitRepository])
{
$Project = $Repository.ProjectReference.Name
}
$tp = Get-TfsTeamProject -Project $Project -Collection $Collection
$tpc = $tp.Store.TeamProjectCollection
$gitClient = Get-TfsClientObject -Type 'Microsoft.TeamFoundation.SourceControl.WebApi.GitHttpClient'
if ($Repository -is [Microsoft.TeamFoundation.SourceControl.WebApi.GitRepository])
{
$reposToRename = @($Repository)
}
else
{
$reposToRename = Get-TfsGitRepository -Name $Repository -Project $Project -Collection $Collection
}
foreach($repo in $reposToRename)
{
if ($PSCmdlet.ShouldProcess($repo.Name, "Rename Git repository in Team Project $($tp.Name) to $NewName"))
{
$task = $gitClient.RenameRepositoryAsync($repo, $NewName)
$task.Wait()
if ($Passthru)
{
return $task.Result
}
}
}
}
}
<#
.SYNOPSIS
Gets information from one or more Git repositories in a team project.
.PARAMETER Project
Specifies either the name of the Team Project or a previously initialized Microsoft.TeamFoundation.WorkItemTracking.Client.Project object to connect to. If omitted, it defaults to the connection opened by Connect-TfsTeamProject (if any).
For more details, see the Get-TfsTeamProject cmdlet.
.PARAMETER Collection
Specifies either a URL/name of the Team Project Collection to connect to, or a previously initialized TfsTeamProjectCollection object.
When using a URL, it must be fully qualified. The format of this string is as follows:
http[s]://<ComputerName>:<Port>/[<TFS-vDir>/]<CollectionName>
Valid values for the Transport segment of the URI are HTTP and HTTPS. If you specify a connection URI with a Transport segment, but do not specify a port, the session is created with standards ports: 80 for HTTP and 443 for HTTPS.
To connect to a Team Project Collection by using its name, a TfsConfigurationServer object must be supplied either via -Server argument or via a previous call to the Connect-TfsConfigurationServer cmdlet.
For more details, see the Get-TfsTeamProjectCollection cmdlet.
#>
Function Get-TfsGitRepository
{
[CmdletBinding()]
[OutputType([Microsoft.TeamFoundation.SourceControl.WebApi.GitRepository])]
Param
(
[Parameter()]
[SupportsWildcards()]
[string]
$Name = '*',
[Parameter(ValueFromPipeline=$true)]
[object]
$Project,
[Parameter()]
[object]
$Collection
)
Process
{
$tp = Get-TfsTeamProject -Project $Project -Collection $Collection
$tpc = $tp.Store.TeamProjectCollection
$id = $tp.Guid
$gitService = $tpc.GetService([type]'Microsoft.TeamFoundation.Git.Client.GitRepositoryService')
return $gitService.QueryRepositories($tp.Name) | ? Name -Like $Name
}
}
<#
.SYNOPSIS
Deletes one or more Git repositories from a team project.
.PARAMETER Project
Specifies either the name of the Team Project or a previously initialized Microsoft.TeamFoundation.WorkItemTracking.Client.Project object to connect to. If omitted, it defaults to the connection opened by Connect-TfsTeamProject (if any).
For more details, see the Get-TfsTeamProject cmdlet.
.PARAMETER Collection
Specifies either a URL/name of the Team Project Collection to connect to, or a previously initialized TfsTeamProjectCollection object.
When using a URL, it must be fully qualified. The format of this string is as follows:
http[s]://<ComputerName>:<Port>/[<TFS-vDir>/]<CollectionName>
Valid values for the Transport segment of the URI are HTTP and HTTPS. If you specify a connection URI with a Transport segment, but do not specify a port, the session is created with standards ports: 80 for HTTP and 443 for HTTPS.
To connect to a Team Project Collection by using its name, a TfsConfigurationServer object must be supplied either via -Server argument or via a previous call to the Connect-TfsConfigurationServer cmdlet.
For more details, see the Get-TfsTeamProjectCollection cmdlet.
#>
Function Remove-TfsGitRepository
{
[CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')]
Param
(
[Parameter(Mandatory=$true, ValueFromPipeline=$true)]
[SupportsWildcards()]
[Alias('Name')]
[object]
$Repository = '*',
[Parameter()]
[object]
$Project,
[Parameter()]
[object]
$Collection
)
Begin
{
Add-Type -AssemblyName 'Microsoft.TeamFoundation.Core.WebApi'
Add-Type -AssemblyName 'Microsoft.TeamFoundation.SourceControl.WebApi'
}
Process
{
if ($Repository -is [Microsoft.TeamFoundation.SourceControl.WebApi.GitRepository])
{
$Project = $Repository.ProjectReference.Name
}
$tp = Get-TfsTeamProject -Project $Project -Collection $Collection
$tpc = $tp.Store.TeamProjectCollection
$gitClient = Get-TfsClientObject -Type 'Microsoft.TeamFoundation.SourceControl.WebApi.GitHttpClient'
if ($Repository -is [Microsoft.TeamFoundation.SourceControl.WebApi.GitRepository])
{
$reposToDelete = @($Repository)
}
else
{
$reposToDelete = Get-TfsGitRepository -Name $Repository -Project $Project -Collection $Collection
}
foreach($repo in $reposToDelete)
{
if ($PSCmdlet.ShouldProcess($repo.Name, "Delete Git repository from Team Project $($tp.Name)"))
{
$gitClient.DeleteRepositoryAsync($repo.Id).Wait()
}
}
}
}
<#
.SYNOPSIS
Creates a new Git repository in a team project.
.PARAMETER Project
Specifies either the name of the Team Project or a previously initialized Microsoft.TeamFoundation.WorkItemTracking.Client.Project object to connect to. If omitted, it defaults to the connection opened by Connect-TfsTeamProject (if any).
For more details, see the Get-TfsTeamProject cmdlet.
.PARAMETER Collection
Specifies either a URL/name of the Team Project Collection to connect to, or a previously initialized TfsTeamProjectCollection object.
When using a URL, it must be fully qualified. The format of this string is as follows:
http[s]://<ComputerName>:<Port>/[<TFS-vDir>/]<CollectionName>
Valid values for the Transport segment of the URI are HTTP and HTTPS. If you specify a connection URI with a Transport segment, but do not specify a port, the session is created with standards ports: 80 for HTTP and 443 for HTTPS.
To connect to a Team Project Collection by using its name, a TfsConfigurationServer object must be supplied either via -Server argument or via a previous call to the Connect-TfsConfigurationServer cmdlet.
For more details, see the Get-TfsTeamProjectCollection cmdlet.
.PARAMETER Passthru
Returns the results of the command. By default, this cmdlet does not generate any output.
#>
Function New-TfsGitRepository
{
Param
(
[Parameter(Mandatory=$true)]
[string]
$Name,
[Parameter(ValueFromPipeline=$true)]
[object]
$Project,
[Parameter()]
[object]
$Collection,
[Parameter()]
[switch]
$Passthru
)
Begin
{
Add-Type -AssemblyName 'Microsoft.TeamFoundation.Core.WebApi'
Add-Type -AssemblyName 'Microsoft.TeamFoundation.SourceControl.WebApi'
}
Process
{
$tp = Get-TfsTeamProject -Project $Project -Collection $Collection
$tpc = $tp.Store.TeamProjectCollection
$gitClient = Get-TfsClientObject -Type 'Microsoft.TeamFoundation.SourceControl.WebApi.GitHttpClient'
$tpRef = [Microsoft.TeamFoundation.Common.TeamProjectReference] @{Id = $tp.Guid; Name = $tp.Name}
$repoToCreate = [Microsoft.TeamFoundation.SourceControl.WebApi.GitRepository] @{Name = $Name; ProjectReference = $tpRef}
$task = $gitClient.CreateRepositoryAsync($repoToCreate, $tp.Name)
$task.Wait()
if ($Passthru)
{
return $task.Result
}
}
}
<#
.SYNOPSIS
Exports the contents of one or more Global Lists to XML.
.PARAMETER Collection
Specifies either a URL/name of the Team Project Collection to connect to, or a previously initialized TfsTeamProjectCollection object.
When using a URL, it must be fully qualified. The format of this string is as follows:
http[s]://<ComputerName>:<Port>/[<TFS-vDir>/]<CollectionName>
Valid values for the Transport segment of the URI are HTTP and HTTPS. If you specify a connection URI with a Transport segment, but do not specify a port, the session is created with standards ports: 80 for HTTP and 443 for HTTPS.
To connect to a Team Project Collection by using its name, a TfsConfigurationServer object must be supplied either via -Server argument or via a previous call to the Connect-TfsConfigurationServer cmdlet.
For more details, see the Get-TfsTeamProjectCollection cmdlet.
#>
Function Export-TfsGlobalList
{
[CmdletBinding()]
[OutputType([xml])]
Param
(
[Parameter()]
[SupportsWildcards()]
[string]
$Name = "*",
[Parameter()]
[object]
$Collection
)
Process
{
$tpc = Get-TfsTeamProjectCollection $Collection
$store = $tpc.GetService([type]'Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemStore')
$xml = [xml] $store.ExportGlobalLists()
$procInstr = $xml.CreateProcessingInstruction("xml", 'version="1.0"')
[void] $xml.InsertBefore($procInstr, $xml.DocumentElement)
$nodesToRemove = $xml.SelectNodes("//GLOBALLIST") #| ? ([System.Xml.XmlElement]$_).GetAttribute("name") -NotLike $Name
foreach($node in $nodesToRemove)
{
if (([System.Xml.XmlElement]$node).GetAttribute("name") -notlike $Name)
{
[void]$xml.DocumentElement.RemoveChild($node)
}
}
return $xml
}
}
<#
.SYNOPSIS
Gets the contents of one or more Global Lists.
.PARAMETER Collection
Specifies either a URL/name of the Team Project Collection to connect to, or a previously initialized TfsTeamProjectCollection object.
When using a URL, it must be fully qualified. The format of this string is as follows:
http[s]://<ComputerName>:<Port>/[<TFS-vDir>/]<CollectionName>
Valid values for the Transport segment of the URI are HTTP and HTTPS. If you specify a connection URI with a Transport segment, but do not specify a port, the session is created with standards ports: 80 for HTTP and 443 for HTTPS.
To connect to a Team Project Collection by using its name, a TfsConfigurationServer object must be supplied either via -Server argument or via a previous call to the Connect-TfsConfigurationServer cmdlet.
For more details, see the Get-TfsTeamProjectCollection cmdlet.
#>
Function Get-TfsGlobalList
{
[CmdletBinding()]
Param
(
[Parameter()]
[SupportsWildcards()]
[string]
$Name = "*",
[Parameter()]
[object]
$Collection
)
Process
{
$xml = Export-TfsGlobalList @PSBoundParameters
foreach($listNode in $xml.SelectNodes("//GLOBALLIST"))
{
$list = [PSCustomObject] [ordered] @{
Name = $listNode.GetAttribute("name")
Items = @()
}
foreach($itemNode in $listNode.SelectNodes("LISTITEM"))
{
$list.Items += $itemNode.GetAttribute("value")
}
$list
}
}
}
<#
.SYNOPSIS
Imports one or more Global Lists from XML.
.PARAMETER Collection
Specifies either a URL/name of the Team Project Collection to connect to, or a previously initialized TfsTeamProjectCollection object.
When using a URL, it must be fully qualified. The format of this string is as follows:
http[s]://<ComputerName>:<Port>/[<TFS-vDir>/]<CollectionName>
Valid values for the Transport segment of the URI are HTTP and HTTPS. If you specify a connection URI with a Transport segment, but do not specify a port, the session is created with standards ports: 80 for HTTP and 443 for HTTPS.
To connect to a Team Project Collection by using its name, a TfsConfigurationServer object must be supplied either via -Server argument or via a previous call to the Connect-TfsConfigurationServer cmdlet.
For more details, see the Get-TfsTeamProjectCollection cmdlet.
#>
Function Import-TfsGlobalList
{
[CmdletBinding()]
Param
(
[Parameter(Mandatory=$true)]
[xml]
$Xml,
[Parameter()]
[object]
$Collection
)
Process
{
$tpc = Get-TfsTeamProjectCollection $Collection
$store = $tpc.GetService([type]'Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemStore')
[void] $store.ImportGlobalLists($Xml.OuterXml)
}
}
<#
.SYNOPSIS
Creates a new Global List.
.PARAMETER Collection
Specifies either a URL/name of the Team Project Collection to connect to, or a previously initialized TfsTeamProjectCollection object.
When using a URL, it must be fully qualified. The format of this string is as follows:
http[s]://<ComputerName>:<Port>/[<TFS-vDir>/]<CollectionName>
Valid values for the Transport segment of the URI are HTTP and HTTPS. If you specify a connection URI with a Transport segment, but do not specify a port, the session is created with standards ports: 80 for HTTP and 443 for HTTPS.
To connect to a Team Project Collection by using its name, a TfsConfigurationServer object must be supplied either via -Server argument or via a previous call to the Connect-TfsConfigurationServer cmdlet.
For more details, see the Get-TfsTeamProjectCollection cmdlet.
#>
Function New-TfsGlobalList
{
Param
(
[Parameter(Mandatory=$true)]
[string]
$Name,
[Parameter(Mandatory=$true)]
[string[]]
$Items,
[Parameter()]
[switch]
$Force,
[Parameter()]
[object]
$Collection
)
Process
{
[xml] $xml = Export-TfsGlobalList -Collection $Collection
# Checks whether the global list already exists
$list = $xml.SelectSingleNode("//GLOBALLIST[@name='$Name']")
if ($list -ne $null)
{
if ($Force.IsPresent)
{
[void] $list.ParentNode.RemoveChild($list)
$overwritten = $true
}
else
{
Throw "Global List $Name already exists. To overwrite an existing list, use the -Force switch."
}
}
# Creates the new list XML element
$list = $xml.CreateElement("GLOBALLIST")
$list.SetAttribute("name", $Name)
# Adds the item elements to the list
foreach($item in $Items)
{
$itemElement = $xml.CreateElement("LISTITEM")
[void] $itemElement.SetAttribute("value", $item)
[void]$list.AppendChild($itemElement)
}
# Appends the new list to the XML obj
[void] $xml.DocumentElement.AppendChild($list)
# Saves the list back to TFS
Import-TfsGlobalList -Xml $xml -Collection $Collection
return Get-TfsGlobalList -Name $Name -Collection $Collection
}
}
<#
.SYNOPSIS
Deletes one or more Global Lists.
.PARAMETER Collection
Specifies either a URL/name of the Team Project Collection to connect to, or a previously initialized TfsTeamProjectCollection object.
When using a URL, it must be fully qualified. The format of this string is as follows:
http[s]://<ComputerName>:<Port>/[<TFS-vDir>/]<CollectionName>
Valid values for the Transport segment of the URI are HTTP and HTTPS. If you specify a connection URI with a Transport segment, but do not specify a port, the session is created with standards ports: 80 for HTTP and 443 for HTTPS.
To connect to a Team Project Collection by using its name, a TfsConfigurationServer object must be supplied either via -Server argument or via a previous call to the Connect-TfsConfigurationServer cmdlet.
For more details, see the Get-TfsTeamProjectCollection cmdlet.
#>
Function Remove-TfsGlobalList
{
[CmdletBinding(ConfirmImpact="High", SupportsShouldProcess=$true)]
Param
(
[Parameter(ValueFromPipelineByPropertyName="Name")]
[SupportsWildcards()]
[string]
$Name = "*",
[Parameter()]
[object]
$Collection
)
Process
{
$tpc = Get-TfsTeamProjectCollection $Collection
$store = $tpc.GetService([type]'Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemStore')
$lists = Get-TfsGlobalList -Name $Name -Collection $Collection
$listsToRemove = @()
foreach($list in $lists)
{
if ($PSCmdlet.ShouldProcess($list.Name, "Remove global list"))
{
$listsToRemove += $list
}
}
if ($listsToRemove.Length -eq 0)
{
return
}
$xml = [xml] "<Package />"
foreach($list in $listsToRemove)
{
$elem = $xml.CreateElement("DestroyGlobalList");
$elem.SetAttribute("ListName", "*" + $list.Name);
$elem.SetAttribute("ForceDelete", "true");
[void]$xml.DocumentElement.AppendChild($elem);
}
$returnElem = $null
$store.SendUpdatePackage($xml.DocumentElement, [ref] $returnElem, $false)
}
}
<#
.SYNOPSIS
Changes the name or the contents of a Global List.
.PARAMETER Collection
Specifies either a URL/name of the Team Project Collection to connect to, or a previously initialized TfsTeamProjectCollection object.
When using a URL, it must be fully qualified. The format of this string is as follows:
http[s]://<ComputerName>:<Port>/[<TFS-vDir>/]<CollectionName>
Valid values for the Transport segment of the URI are HTTP and HTTPS. If you specify a connection URI with a Transport segment, but do not specify a port, the session is created with standards ports: 80 for HTTP and 443 for HTTPS.
To connect to a Team Project Collection by using its name, a TfsConfigurationServer object must be supplied either via -Server argument or via a previous call to the Connect-TfsConfigurationServer cmdlet.
For more details, see the Get-TfsTeamProjectCollection cmdlet.
#>
Function Set-TfsGlobalList
{
Param
(
[Parameter(Mandatory=$true)]
[string]
$Name,
[Parameter(ParameterSetName="Edit list items")]
[string[]]
$Add,
[Parameter(ParameterSetName="Edit list items")]
[string[]]
$Remove,
[Parameter(ParameterSetName="Rename list", Mandatory=$true)]
[string]
$NewName,
[Parameter(ParameterSetName="Edit list items")]
[switch]
$Force,
[object]
$Collection
)
Process
{
[xml] $xml = Export-TfsGlobalList -Name $Name -Collection $Collection
# Retrieves the list
$list = $xml.SelectSingleNode("//GLOBALLIST")
$newList = $false
if ($list -eq $null)
{
if (-not $Force.IsPresent)
{
throw "Global list name $Name is invalid or non-existent. Either check the name or use -Force to create a new list."
}
# Creates the new list XML element
$list = $xml.CreateElement("GLOBALLIST")
[void] $list.SetAttribute("name", $Name)
[void] $xml.DocumentElement.AppendChild($list)
$newList = $true
}
if ($PSCmdlet.ParameterSetName -eq "Rename list")
{
$list.SetAttribute("name", $NewName)
Import-TfsGlobalList -Xml $xml -Collection $Collection
Remove-TfsGlobalList -Name $Name -Collection $Collection -Confirm:$false
return Get-TfsGlobalList -Name $NewName -Collection $Collection
}
foreach($item in $Add)
{
if (-not $newList)
{
# Checks if the element exists (prevents duplicates)
$existingItem = $list.SelectSingleNode("LISTITEM[@value='$item']")
if ($existingItem -ne $null) { continue }
}
$itemElement = $xml.CreateElement("LISTITEM")
[void] $itemElement.SetAttribute("value", $item)
[void]$list.AppendChild($itemElement)
}
if (-not $newList)
{
foreach($item in $Remove)
{
$existingItem = $list.SelectSingleNode("LISTITEM[@value='$item']")
if ($existingItem)
{
[void]$list.RemoveChild($existingItem)
}
}
}
# Saves the list back to TFS
Import-TfsGlobalList -Xml $xml -Collection $Collection
return Get-TfsGlobalList -Name $Name -Collection $Collection
}
}
<#
.SYNOPSIS
Gets an Team Foundation Server REST API client object.
.PARAMETER Collection
Specifies either a URL/name of the Team Project Collection to connect to, or a previously initialized TfsTeamProjectCollection object.
When using a URL, it must be fully qualified. The format of this string is as follows:
http[s]://<ComputerName>:<Port>/[<TFS-vDir>/]<CollectionName>
Valid values for the Transport segment of the URI are HTTP and HTTPS. If you specify a connection URI with a Transport segment, but do not specify a port, the session is created with standards ports: 80 for HTTP and 443 for HTTPS.
To connect to a Team Project Collection by using its name, a TfsConfigurationServer object must be supplied either via -Server argument or via a previous call to the Connect-TfsConfigurationServer cmdlet.
For more details, see the Get-TfsTeamProjectCollection cmdlet.
#>
Function Get-TfsHttpClient
{
Param
(
[Parameter(Mandatory=$true, Position=0)]
[string]
$Type,
[Parameter()]
[object]
$Collection
)
Process
{
$tpc = Get-TfsTeamProjectCollection -Collection $Collection
return Invoke-GenericMethod -InputObject $tpc -MethodName GetClient -GenericType $Type
}
}#
# _InvokeGenericMethod.ps1
#
function Invoke-GenericMethod
{
<#
.Synopsis
Invokes Generic methods on .NET Framework types
.DESCRIPTION
Allows the caller to invoke a Generic method on a .NET object or class with a single function call. Invoke-GenericMethod handles identifying the proper method overload, parameters with default values, and to some extent, the same type conversion behavior you expect when calling a normal .NET Framework method from PowerShell.
.PARAMETER InputObject
The object on which to invoke an instance generic method.
.PARAMETER Type
The .NET class on which to invoke a static generic method.
.PARAMETER MethodName
The name of the generic method to be invoked.
.PARAMETER GenericType
One or more types which are specified when calling the generic method. For example, if a method's signature is "string MethodName<T>();", and you want T to be a String, then you would pass "string" or ([string]) to the Type parameter of Invoke-GenericMethod.
.PARAMETER ArgumentList
The arguments to be passed on to the generic method when it is invoked. The order of the arguments must match that of the .NET method's signature; named parameters are not currently supported.
.EXAMPLE
Invoke-GenericMethod -InputObject $someObject -MethodName SomeMethodName -GenericType string -ArgumentList $arg1,$arg2,$arg3
Invokes a generic method on an object. The signature of this method would be something like this (containing 3 arguments and a single Generic type argument): object SomeMethodName<T>(object arg1, object arg2, object arg3);
.EXAMPLE
$someObject | Invoke-GenericMethod -MethodName SomeMethodName -GenericType string -ArgumentList $arg1,$arg2,$arg3
Same as example 1, except $someObject is passed to the function via the pipeline.
.EXAMPLE
Invoke-GenericMethod -Type SomeClass -MethodName SomeMethodName -GenericType string,int -ArgumentList $arg1,$arg2,$arg3
Invokes a static generic method on a class. The signature of this method would be something like this (containing 3 arguments and two Generic type arguments): static object SomeMethodName<T1,T2> (object arg1, object arg2, object arg3);
.INPUTS
System.Object
.OUTPUTS
System.Object
.NOTES
Known issues:
Ref / Out parameters and [PSReference] objects are currently not working properly, and I don't think there's a way to fix that from within PowerShell. I'll have to expand on the
PSGenericTypes.MethodInvoker.InvokeMethod() C# code to account for that.
#>
[CmdletBinding(DefaultParameterSetName = 'Instance')]
param (
[Parameter(Mandatory = $true, ValueFromPipeline = $true, ParameterSetName = 'Instance')]
$InputObject,
[Parameter(Mandatory = $true, ParameterSetName = 'Static')]
[Type]
$Type,
[Parameter(Mandatory = $true)]
[string]
$MethodName,
[Parameter(Mandatory = $true)]
[Type[]]
$GenericType,
[Object[]]
$ArgumentList
)
process
{
switch ($PSCmdlet.ParameterSetName)
{
'Instance'
{
$_type = $InputObject.GetType()
$object = $InputObject
$flags = [System.Reflection.BindingFlags] 'Instance, Public'
}
'Static'
{
$_type = $Type
$object = $null
$flags = [System.Reflection.BindingFlags] 'Static, Public'
}
}
if ($null -ne $ArgumentList)
{
$argList = $ArgumentList.Clone()
}
else
{
$argList = @()
}
$params = @{
Type = $_type
BindingFlags = $flags
MethodName = $MethodName
GenericType = $GenericType
ArgumentList = [ref]$argList
}
$method = Get-GenericMethod @params
if ($null -eq $method)
{
Write-Error "No matching method was found"
return
}
# I'm not sure why, but PowerShell appears to be passing instances of PSObject when $argList contains generic types. Instead of calling
# $method.Invoke here from PowerShell, I had to write the PSGenericMethods.MethodInvoker.InvokeMethod helper code in C# to enumerate the
# argument list and replace any instances of PSObject with their BaseObject before calling $method.Invoke().
return [PSGenericMethods.MethodInvoker]::InvokeMethod($method, $object, $argList)
} # process
} # function Invoke-GenericMethod
function Get-GenericMethod
{
[CmdletBinding()]
param (
[Parameter(Mandatory = $true)]
[Type]
$Type,
[Parameter(Mandatory = $true)]
[string]
$MethodName,
[Parameter(Mandatory = $true)]
[Type[]]
$GenericType,
[ref]
$ArgumentList,
[System.Reflection.BindingFlags]
$BindingFlags = [System.Reflection.BindingFlags]::Default,
[switch]
$WithCoercion
)
if ($null -eq $ArgumentList.Value)
{
$originalArgList = @()
}
else
{
$originalArgList = @($ArgumentList.Value)
}
foreach ($method in $Type.GetMethods($BindingFlags))
{
$argList = $originalArgList.Clone()
if (-not $method.IsGenericMethod -or $method.Name -ne $MethodName) { continue }
if ($GenericType.Count -ne $method.GetGenericArguments().Count) { continue }
if (Test-GenericMethodParameters -MethodInfo $method -ArgumentList ([ref]$argList) -GenericType $GenericType -WithCoercion:$WithCoercion)
{
$ArgumentList.Value = $argList
return $method.MakeGenericMethod($GenericType)
}
}
if (-not $WithCoercion)
{
$null = $PSBoundParameters.Remove('WithCoercion')
return Get-GenericMethod @PSBoundParameters -WithCoercion
}
} # function Get-GenericMethod
function Test-GenericMethodParameters
{
[CmdletBinding()]
param (
[System.Reflection.MethodInfo] $MethodInfo,
[ref]
$ArgumentList,
[Parameter(Mandatory = $true)]
[Type[]]
$GenericType,
[switch]
$WithCoercion
)
if ($null -eq $ArgumentList.Value)
{
$argList = @()
}
else
{
$argList = @($ArgumentList.Value)
}
$parameterList = $MethodInfo.GetParameters()
$arrayType = $null
$hasParamsArray = HasParamsArray -ParameterList $parameterList
if ($parameterList.Count -lt $argList.Count -and -not $hasParamsArray)
{
return $false
}
$methodGenericType = $MethodInfo.GetGenericArguments()
for ($i = 0; $i -lt $argList.Count; $i++)
{
$params = @{
ArgumentList = $argList
ParameterList = $ParameterList
WithCoercion = $WithCoercion
RuntimeGenericType = $GenericType
MethodGenericType = $methodGenericType
Index = [ref]$i
ArrayType = [ref]$arrayType
}
$isOk = TryMatchParameter @params
if (-not $isOk) { return $false }
}
$defaults = New-Object System.Collections.ArrayList
for ($i = $argList.Count; $i -lt $parameterList.Count; $i++)
{
if (-not $parameterList[$i].HasDefaultValue) { return $false }
$null = $defaults.Add($parameterList[$i].DefaultValue)
}
# When calling a method with a params array using MethodInfo, you have to pass in the array; the
# params argument approach doesn't work.
if ($hasParamsArray)
{
$firstArrayIndex = $parameterList.Count - 1
$lastArrayIndex = $argList.Count - 1
$newArgList = $argList[0..$firstArrayIndex]
$newArgList[$firstArrayIndex] = $argList[$firstArrayIndex..$lastArrayIndex] -as $arrayType
$argList = $newArgList
}
$ArgumentList.Value = $argList + $defaults.ToArray()
return $true
} # function Test-GenericMethodParameters
function TryMatchParameter
{
param (
[System.Reflection.ParameterInfo[]]
$ParameterList,
[object[]]
$ArgumentList,
[Type[]]
$MethodGenericType,
[Type[]]
$RuntimeGenericType,
[switch]
$WithCoercion,
[ref] $Index,
[ref] $ArrayType
)
$params = @{
ParameterType = $ParameterList[$Index.Value].ParameterType
RuntimeType = $RuntimeGenericType
GenericType = $MethodGenericType
}
$runtimeType = Resolve-RuntimeType @params
if ($null -eq $runtimeType)
{
throw "Could not determine runtime type of parameter '$($ParameterList[$Index.Value].Name)'"
}
$isParamsArray = IsParamsArray -ParameterInfo $ParameterList[$Index.Value]
if ($isParamsArray)
{
$ArrayType.Value = $runtimeType
$runtimeType = $runtimeType.GetElementType()
}
do
{
$isOk = TryMatchArgument @PSBoundParameters -RuntimeType $runtimeType
if (-not $isOk) { return $false }
if ($isParamsArray) { $Index.Value++ }
}
while ($isParamsArray -and $Index.Value -lt $ArgumentList.Count)
return $true
}
function TryMatchArgument
{
param (
[System.Reflection.ParameterInfo[]]
$ParameterList,
[object[]]
$ArgumentList,
[Type[]]
$MethodGenericType,
[Type[]]
$RuntimeGenericType,
[switch]
$WithCoercion,
[ref] $Index,
[ref] $ArrayType,
[Type] $RuntimeType
)
$argValue = $ArgumentList[$Index.Value]
$argType = Get-Type $argValue
$isByRef = $RuntimeType.IsByRef
if ($isByRef)
{
if ($ArgumentList[$Index.Value] -isnot [ref]) { return $false }
$RuntimeType = $RuntimeType.GetElementType()
$argValue = $argValue.Value
$argType = Get-Type $argValue
}
$isNullNullable = $false
while ($RuntimeType.FullName -like 'System.Nullable``1*')
{
if ($null -eq $argValue)
{
$isNullNullable = $true
break
}
$RuntimeType = $RuntimeType.GetGenericArguments()[0]
}
if ($isNullNullable) { continue }
if ($null -eq $argValue)
{
return -not $RuntimeType.IsValueType
}
else
{
if ($argType -ne $RuntimeType)
{
$argValue = $argValue -as $RuntimeType
if (-not $WithCoercion -or $null -eq $argValue) { return $false }
}
if ($isByRef)
{
$ArgumentList[$Index.Value].Value = $argValue
}
else
{
$ArgumentList[$Index.Value] = $argValue
}
}
return $true
}
function HasParamsArray([System.Reflection.ParameterInfo[]] $ParameterList)
{
return $ParameterList.Count -gt 0 -and (IsParamsArray -ParameterInfo $ParameterList[-1])
}
function IsParamsArray([System.Reflection.ParameterInfo] $ParameterInfo)
{
return @($ParameterInfo.GetCustomAttributes([System.ParamArrayAttribute], $true)).Count -gt 0
}
function Resolve-RuntimeType
{
[CmdletBinding()]
param (
[Parameter(Mandatory = $true)]
[Type]
$ParameterType,
[Parameter(Mandatory = $true)]
[Type[]]
$RuntimeType,
[Parameter(Mandatory = $true)]
[Type[]]
$GenericType
)
if ($ParameterType.IsByRef)
{
$elementType = Resolve-RuntimeType -ParameterType $ParameterType.GetElementType() -RuntimeType $RuntimeType -GenericType $GenericType
return $elementType.MakeByRefType()
}
elseif ($ParameterType.IsGenericParameter)
{
for ($i = 0; $i -lt $GenericType.Count; $i++)
{
if ($ParameterType -eq $GenericType[$i])
{
return $RuntimeType[$i]
}
}
}
elseif ($ParameterType.IsArray)
{
$arrayType = $ParameterType
$elementType = Resolve-RuntimeType -ParameterType $ParameterType.GetElementType() -RuntimeType $RuntimeType -GenericType $GenericType
if ($ParameterType.GetElementType().IsGenericParameter)
{
$arrayRank = $arrayType.GetArrayRank()
if ($arrayRank -eq 1)
{
$arrayType = $elementType.MakeArrayType()
}
else
{
$arrayType = $elementType.MakeArrayType($arrayRank)
}
}
return $arrayType
}
elseif ($ParameterType.ContainsGenericParameters)
{
$genericArguments = $ParameterType.GetGenericArguments()
$runtimeArguments = New-Object System.Collections.ArrayList
foreach ($argument in $genericArguments)
{
$null = $runtimeArguments.Add((Resolve-RuntimeType -ParameterType $argument -RuntimeType $RuntimeType -GenericType $GenericType))
}
$definition = $ParameterType
if (-not $definition.IsGenericTypeDefinition)
{
$definition = $definition.GetGenericTypeDefinition()
}
return $definition.MakeGenericType($runtimeArguments.ToArray())
}
else
{
return $ParameterType
}
}
function Get-Type($object)
{
if ($null -eq $object) { return $null }
return $object.GetType()
}
Add-Type -ErrorAction Stop -TypeDefinition @'
namespace PSGenericMethods
{
using System;
using System.Reflection;
using System.Management.Automation;
public static class MethodInvoker
{
public static object InvokeMethod(MethodInfo method, object target, object[] arguments)
{
if (method == null) { throw new ArgumentNullException("method"); }
object[] args = null;
if (arguments != null)
{
args = (object[])arguments.Clone();
for (int i = 0; i < args.Length; i++)
{
PSObject pso = args[i] as PSObject;
if (pso != null)
{
args[i] = pso.BaseObject;
}
PSReference psref = args[i] as PSReference;
if (psref != null)
{
args[i] = psref.Value;
}
}
}
object result = method.Invoke(target, args);
for (int i = 0; i < arguments.Length; i++)
{
PSReference psref = arguments[i] as PSReference;
if (psref != null)
{
psref.Value = args[i];
}
}
return result;
}
}
}
'@
<#
.SYNOPSIS
Imports a process template definition from disk.
.PARAMETER Collection
Specifies either a URL/name of the Team Project Collection to connect to, or a previously initialized TfsTeamProjectCollection object.
When using a URL, it must be fully qualified. The format of this string is as follows:
http[s]://<ComputerName>:<Port>/[<TFS-vDir>/]<CollectionName>
Valid values for the Transport segment of the URI are HTTP and HTTPS. If you specify a connection URI with a Transport segment, but do not specify a port, the session is created with standards ports: 80 for HTTP and 443 for HTTPS.
To connect to a Team Project Collection by using its name, a TfsConfigurationServer object must be supplied either via -Server argument or via a previous call to the Connect-TfsConfigurationServer cmdlet.
For more details, see the Get-TfsTeamProjectCollection cmdlet.
#>
Function Import-TfsProcessTemplate
{
Param
(
[Parameter(Position=0, Mandatory=$true)]
[ValidateScript({Test-Path $_ -PathType Container})]
[string]
$SourcePath,
[Parameter()]
[ValidateSet("Visible")]
[string]
$State = "Visible",
[Parameter(ValueFromPipeline=$true)]
[Microsoft.TeamFoundation.Client.TfsTeamProjectCollection]
$Collection
)
Process
{
if (-Not (Test-Path (Join-Path $SourcePath "ProcessTemplate.xml")))
{
throw "Invalid path. Source path ""$SourcePath"" must be a directory and must contain a file named ProcessTemplate.xml."
}
$tpc = Get-TfsTeamProjectCollection $Collection
$processTemplateSvc = $tpc.GetService([type]"Microsoft.TeamFoundation.Server.IProcessTemplates")
$tempFile = New-TemporaryFile
$zipFile = "$tempFile.zip"
Rename-Item $tempFile -NewName (Split-Path $zipFile -Leaf)
Compress-Archive -Path $SourcePath -DestinationPath $zipFile -Force
$ptFile = (Join-Path $SourcePath "ProcessTemplate.xml")
$ptXml = [xml] (Get-Content $ptFile)
$name = $ptXml.ProcessTemplate.metadata.name
$description = $ptXml.ProcessTemplate.metadata.description
$metadata = $ptXml.ProcessTemplate.metadata.OuterXml
$processTemplateSvc.AddUpdateTemplate($name, $description, $metadata, $State, $tempFile);
Remove-Item $zipFile
}
}
<#
.SYNOPSIS
Exports a process template definition to disk.
.PARAMETER Collection
Specifies either a URL/name of the Team Project Collection to connect to, or a previously initialized TfsTeamProjectCollection object.
When using a URL, it must be fully qualified. The format of this string is as follows:
http[s]://<ComputerName>:<Port>/[<TFS-vDir>/]<CollectionName>
Valid values for the Transport segment of the URI are HTTP and HTTPS. If you specify a connection URI with a Transport segment, but do not specify a port, the session is created with standards ports: 80 for HTTP and 443 for HTTPS.
To connect to a Team Project Collection by using its name, a TfsConfigurationServer object must be supplied either via -Server argument or via a previous call to the Connect-TfsConfigurationServer cmdlet.
For more details, see the Get-TfsTeamProjectCollection cmdlet.
#>
Function Export-TfsProcessTemplate
{
Param
(
[Parameter(Position=0)]
[SupportsWildcards()]
[object]
$Process = "*",
[Parameter(Mandatory=$true)]
[string]
$DestinationPath,
[Parameter()]
[ValidateNotNullOrEmpty()]
[string]
$NewName,
[Parameter()]
[ValidateNotNullOrEmpty()]
[string]
$NewDescription,
[Parameter(ValueFromPipeline=$true)]
[Microsoft.TeamFoundation.Client.TfsTeamProjectCollection]
$Collection
)
Process
{
$tpc = Get-TfsTeamProjectCollection $Collection
$processTemplateSvc = $tpc.GetService([type]"Microsoft.TeamFoundation.Server.IProcessTemplates")
if ($Process -is [Microsoft.TeamFoundation.Server.TemplateHeader])
{
$templates = @($Process)
}
else
{
$templates = Get-TfsProcessTemplate $Process -Collection $Collection
}
if ($NewName -or $NewDescription)
{
$templates = $templates | select -First 1
}
foreach($template in $templates)
{
if ($NewName)
{
$templateName = $NewName
}
else
{
$templateName = $template.Name
}
$tempFile = $processTemplateSvc.GetTemplateData($template.TemplateId)
$zipFile = "$tempFile.zip"
Rename-Item -Path $tempFile -NewName (Split-Path $zipFile -Leaf)
$outDir = Join-Path $DestinationPath $templateName
New-Item $outDir -ItemType Directory -Force | Out-Null
Expand-Archive -Path $zipFile -DestinationPath $outDir
if ($NewName -or $NewDescription)
{
$ptFile = (Join-Path $outDir "ProcessTemplate.xml")
$ptXml = [xml] (Get-Content $ptFile)
if ($NewName)
{
$ptXml.ProcessTemplate.metadata.name = $NewName
}
if ($NewDescription)
{
$ptXml.ProcessTemplate.metadata.description = $NewDescription
}
$ptXml.Save($ptFile)
}
Remove-Item $zipFile
}
}
}
<#
.SYNOPSIS
Gets information from one or more process templates.
.PARAMETER Collection
Specifies either a URL/name of the Team Project Collection to connect to, or a previously initialized TfsTeamProjectCollection object.
When using a URL, it must be fully qualified. The format of this string is as follows:
http[s]://<ComputerName>:<Port>/[<TFS-vDir>/]<CollectionName>
Valid values for the Transport segment of the URI are HTTP and HTTPS. If you specify a connection URI with a Transport segment, but do not specify a port, the session is created with standards ports: 80 for HTTP and 443 for HTTPS.
To connect to a Team Project Collection by using its name, a TfsConfigurationServer object must be supplied either via -Server argument or via a previous call to the Connect-TfsConfigurationServer cmdlet.
For more details, see the Get-TfsTeamProjectCollection cmdlet.
#>
Function Get-TfsProcessTemplate
{
Param
(
[Parameter(Position=0)]
[SupportsWildcards()]
[string]
$Name = "*",
[Parameter(ValueFromPipeline=$true)]
[object]
$Collection
)
Process
{
$tpc = Get-TfsTeamProjectCollection $Collection
$processTemplateSvc = $tpc.GetService([type]"Microsoft.TeamFoundation.Server.IProcessTemplates")
$templateHeaders = $processTemplateSvc.TemplateHeaders() | ? Name -Like $Name
foreach($templateHeader in $templateHeaders)
{
$templateHeader | Add-Member Collection $tpc.DisplayName -PassThru
}
}
}
$binDir = (Join-Path $PSScriptRoot 'lib')
$assemblyList = ''
foreach($a in Get-ChildItem $binDir)
{
$assemblyList += "{""$($a.BaseName)"", @""$($a.FullName)""},`r`n"
}
if (-not ([System.Management.Automation.PSTypeName]'TfsCmdlets.AssemblyResolver').Type)
{
Add-Type -ErrorAction SilentlyContinue -Language CSharp -TypeDefinition @"
using System;
using System.Collections.Generic;
using System.Reflection;
namespace TfsCmdlets
{
public class AssemblyResolver
{
private static readonly Dictionary<string, string> _PrivateAssemblies = new Dictionary<string, string>
{
$assemblyList
};
public static void Register()
{
AppDomain.CurrentDomain.AssemblyResolve += delegate(object sender, ResolveEventArgs e)
{
try
{
return _PrivateAssemblies.ContainsKey(e.Name)
? Assembly.LoadFrom(_PrivateAssemblies[e.Name])
: null;
}
catch
{
return null;
}
};
}
}
}
"@
}
[TfsCmdlets.AssemblyResolver]::Register()
# Initialize Shell
if ($Host.UI.RawUI.WindowTitle -eq "Team Foundation Server Shell")
{
# SetConsoleColors
$Host.UI.RawUI.BackgroundColor = "DarkMagenta"
$Host.UI.RawUI.ForegroundColor = "White"
Clear-Host
# ShowBanner
$module = Test-ModuleManifest -Path (Join-Path $PSScriptRoot 'TfsCmdlets.psd1')
Write-Host "TfsCmdlets: $($module.Description)"
Write-Host "Version $($module.PrivateData.Build)"
Write-Host ""
@'
Function Prompt
{
Process
{
$tfsPrompt = ''
if ($global:TfsServerConnection)
{
$tfsPrompt = $global:TfsServerConnection.Name
if ($global:TfsTpcConnection)
{
$tfsPrompt += "/$($global:TfsTpcConnection.Name)"
}
if ($global:TfsProjectConnection)
{
$tfsPrompt += "/$($global:TfsProjectConnection.Name)"
}
if ($global:TfsTeamConnection)
{
$tfsPrompt += "/$($global:TfsTeamConnection.Name)"
}
$tfsPrompt = "[$tfsPrompt] "
}
"TFS ${tfsPrompt}$($executionContext.SessionState.Path.CurrentLocation)$('>' * ($nestedPromptLevel + 1)) "
}
}
'@ | Invoke-Expression
}
# Load basic TFS client assemblies
Add-Type -AssemblyName 'Microsoft.TeamFoundation.Common'
Add-Type -AssemblyName 'Microsoft.TeamFoundation.Client'
Add-Type -AssemblyName 'Microsoft.TeamFoundation.WorkItemTracking.Client'
Add-Type -AssemblyName 'Microsoft.TeamFoundation.Build.Client'
Add-Type -AssemblyName 'Microsoft.TeamFoundation.Git.Client'
Add-Type -AssemblyName 'Microsoft.TeamFoundation.VersionControl.Client'
Add-Type -AssemblyName 'Microsoft.TeamFoundation.SourceControl.WebApi'
<#
.SYNOPSIS
Renames a team.
.PARAMETER Project
Specifies either the name of the Team Project or a previously initialized Microsoft.TeamFoundation.WorkItemTracking.Client.Project object to connect to. If omitted, it defaults to the connection opened by Connect-TfsTeamProject (if any).
For more details, see the Get-TfsTeamProject cmdlet.
.PARAMETER Collection
Specifies either a URL/name of the Team Project Collection to connect to, or a previously initialized TfsTeamProjectCollection object.
When using a URL, it must be fully qualified. The format of this string is as follows:
http[s]://<ComputerName>:<Port>/[<TFS-vDir>/]<CollectionName>
Valid values for the Transport segment of the URI are HTTP and HTTPS. If you specify a connection URI with a Transport segment, but do not specify a port, the session is created with standards ports: 80 for HTTP and 443 for HTTPS.
To connect to a Team Project Collection by using its name, a TfsConfigurationServer object must be supplied either via -Server argument or via a previous call to the Connect-TfsConfigurationServer cmdlet.
For more details, see the Get-TfsTeamProjectCollection cmdlet.
#>
Function Rename-TfsTeam
{
[OutputType([Microsoft.TeamFoundation.Client.TeamFoundationTeam])]
param
(
[Parameter(Position=0, ValueFromPipeline=$true)]
[Alias("Name")]
[ValidateScript({($_ -is [string]) -or ($_ -is [Microsoft.TeamFoundation.Client.TeamFoundationTeam])})]
[SupportsWildcards()]
[object]
$Team = '*',
[Parameter()]
[string]
$NewName,
[Parameter()]
[object]
$Project,
[Parameter()]
[object]
$Collection
)
Process
{
Set-TfsTeam -Team $Team -NewName $NewName -Project $Project -Collection $Collection
}
}
<#
.SYNOPSIS
Gets information about one or more teams.
.PARAMETER Project
Specifies either the name of the Team Project or a previously initialized Microsoft.TeamFoundation.WorkItemTracking.Client.Project object to connect to. If omitted, it defaults to the connection opened by Connect-TfsTeamProject (if any).
For more details, see the Get-TfsTeamProject cmdlet.
.PARAMETER Collection
Specifies either a URL/name of the Team Project Collection to connect to, or a previously initialized TfsTeamProjectCollection object.
When using a URL, it must be fully qualified. The format of this string is as follows:
http[s]://<ComputerName>:<Port>/[<TFS-vDir>/]<CollectionName>
Valid values for the Transport segment of the URI are HTTP and HTTPS. If you specify a connection URI with a Transport segment, but do not specify a port, the session is created with standards ports: 80 for HTTP and 443 for HTTPS.
To connect to a Team Project Collection by using its name, a TfsConfigurationServer object must be supplied either via -Server argument or via a previous call to the Connect-TfsConfigurationServer cmdlet.
For more details, see the Get-TfsTeamProjectCollection cmdlet.
#>
Function Get-TfsTeam
{
[CmdletBinding(DefaultParameterSetName="Get by name")]
[OutputType([Microsoft.TeamFoundation.Client.TeamFoundationTeam])]
param
(
[Parameter(Position=0, ParameterSetName="Get by name")]
[Alias("Name")]
[ValidateScript({($_ -is [string]) -or ($_ -is [Microsoft.TeamFoundation.Client.TeamFoundationTeam])})]
[SupportsWildcards()]
[object]
$Team = '*',
[Parameter(Position=0, ParameterSetName="Get default team")]
[switch]
$Default,
[Parameter()]
[switch]
$IncludeMembers,
[Parameter()]
[Microsoft.TeamFoundation.Framework.Common.MembershipQuery]
$QueryMembership = [Microsoft.TeamFoundation.Framework.Common.MembershipQuery]::Direct,
[Parameter(ValueFromPipeline=$true)]
[object]
$Project,
[Parameter()]
[object]
$Collection
)
Process
{
if ($Team -is [Microsoft.TeamFoundation.Client.TeamFoundationTeam])
{
return $Team
}
$tp = Get-TfsTeamProject -Project $Project -Collection $Collection
$tpc = $tp.Store.TeamProjectCollection
$teamService = $tpc.GetService([type]'Microsoft.TeamFoundation.Client.TfsTeamService')
if ($Default)
{
$teams = @($teamService.GetDefaultTeam($tp.Uri, $null))
}
else
{
$teams = $teamService.QueryTeams([string]$tp.Uri) | ? Name -like $Team
}
foreach($t in $teams)
{
if ($IncludeMembers)
{
$members = $t.GetMembers($tpc, $QueryMembership)
$t | Add-Member -Name 'Members' -MemberType ([System.Management.Automation.PSMemberTypes]::NoteProperty) -Value $members -PassThru
}
else
{
$t | Add-Member -Name 'Members' -MemberType ([System.Management.Automation.PSMemberTypes]::NoteProperty) -Value ([Microsoft.TeamFoundation.Framework.Client.TeamFoundationIdentity[]] @()) -PassThru
}
}
}
}
<#
.SYNOPSIS
Creates a new team.
.PARAMETER Project
Specifies either the name of the Team Project or a previously initialized Microsoft.TeamFoundation.WorkItemTracking.Client.Project object to connect to. If omitted, it defaults to the connection opened by Connect-TfsTeamProject (if any).
For more details, see the Get-TfsTeamProject cmdlet.
.PARAMETER Collection
Specifies either a URL/name of the Team Project Collection to connect to, or a previously initialized TfsTeamProjectCollection object.
When using a URL, it must be fully qualified. The format of this string is as follows:
http[s]://<ComputerName>:<Port>/[<TFS-vDir>/]<CollectionName>
Valid values for the Transport segment of the URI are HTTP and HTTPS. If you specify a connection URI with a Transport segment, but do not specify a port, the session is created with standards ports: 80 for HTTP and 443 for HTTPS.
To connect to a Team Project Collection by using its name, a TfsConfigurationServer object must be supplied either via -Server argument or via a previous call to the Connect-TfsConfigurationServer cmdlet.
For more details, see the Get-TfsTeamProjectCollection cmdlet.
.PARAMETER Passthru
Returns the results of the command. By default, this cmdlet does not generate any output.
#>
Function New-TfsTeam
{
[CmdletBinding()]
[OutputType([Microsoft.TeamFoundation.Client.TeamFoundationTeam])]
param
(
[Parameter(Mandatory=$true, ValueFromPipeline=$true)]
[Alias("Name")]
[string]
$Team,
[Parameter()]
[string]
$Description,
[Parameter(ValueFromPipeline=$true)]
[object]
$Project,
[Parameter()]
[object]
$Collection,
[Parameter()]
[switch]
$Passthru
)
Process
{
$tp = Get-TfsTeamProject -Project $Project -Collection $Collection
$tpc = $tp.Store.TeamProjectCollection
$teamService = $tpc.GetService([type]"Microsoft.TeamFoundation.Client.TfsTeamService")
$newTeam = $teamService.CreateTeam($tp.Uri, $Team, $Description, $null)
if ($Passthru)
{
return $team
}
}
}
<#
.SYNOPSIS
Deletes a team.
.PARAMETER Project
Specifies either the name of the Team Project or a previously initialized Microsoft.TeamFoundation.WorkItemTracking.Client.Project object to connect to. If omitted, it defaults to the connection opened by Connect-TfsTeamProject (if any).
For more details, see the Get-TfsTeamProject cmdlet.
.PARAMETER Collection
Specifies either a URL/name of the Team Project Collection to connect to, or a previously initialized TfsTeamProjectCollection object.
When using a URL, it must be fully qualified. The format of this string is as follows:
http[s]://<ComputerName>:<Port>/[<TFS-vDir>/]<CollectionName>
Valid values for the Transport segment of the URI are HTTP and HTTPS. If you specify a connection URI with a Transport segment, but do not specify a port, the session is created with standards ports: 80 for HTTP and 443 for HTTPS.
To connect to a Team Project Collection by using its name, a TfsConfigurationServer object must be supplied either via -Server argument or via a previous call to the Connect-TfsConfigurationServer cmdlet.
For more details, see the Get-TfsTeamProjectCollection cmdlet.
#>
Function Remove-TfsTeam
{
[CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')]
[OutputType([Microsoft.TeamFoundation.Client.TeamFoundationTeam])]
param
(
[Parameter(Position=0, ValueFromPipeline=$true)]
[Alias("Name")]
[ValidateScript({($_ -is [string]) -or ($_ -is [Microsoft.TeamFoundation.Client.TeamFoundationTeam])})]
[SupportsWildcards()]
[object]
$Team = '*',
[Parameter()]
[object]
$Project,
[Parameter()]
[object]
$Collection
)
Process
{
$t = Get-TfsTeam -Team $Team -Project $Project -Collection $Collection
if ($PSCmdlet.ShouldProcess($t.Name, 'Delete team'))
{
$tp = Get-TfsTeamProject -Project $Project -Collection $Collection
$tpc = $tp.Store.TeamProjectCollection
$identityService = $tpc.GetService([type]'Microsoft.TeamFoundation.Framework.Client.IIdentityManagementService')
$identityService.DeleteApplicationGroup($t.Identity.Descriptor)
}
}
}
<#
.SYNOPSIS
Changes the details of a team.
.PARAMETER Project
Specifies either the name of the Team Project or a previously initialized Microsoft.TeamFoundation.WorkItemTracking.Client.Project object to connect to. If omitted, it defaults to the connection opened by Connect-TfsTeamProject (if any).
For more details, see the Get-TfsTeamProject cmdlet.
.PARAMETER Collection
Specifies either a URL/name of the Team Project Collection to connect to, or a previously initialized TfsTeamProjectCollection object.
When using a URL, it must be fully qualified. The format of this string is as follows:
http[s]://<ComputerName>:<Port>/[<TFS-vDir>/]<CollectionName>
Valid values for the Transport segment of the URI are HTTP and HTTPS. If you specify a connection URI with a Transport segment, but do not specify a port, the session is created with standards ports: 80 for HTTP and 443 for HTTPS.
To connect to a Team Project Collection by using its name, a TfsConfigurationServer object must be supplied either via -Server argument or via a previous call to the Connect-TfsConfigurationServer cmdlet.
For more details, see the Get-TfsTeamProjectCollection cmdlet.
#>
Function Set-TfsTeam
{
[CmdletBinding(DefaultParameterSetName="Get by name")]
[OutputType([Microsoft.TeamFoundation.Client.TeamFoundationTeam])]
param
(
[Parameter(Position=0, ValueFromPipeline=$true)]
[Alias("Name")]
[ValidateScript({($_ -is [string]) -or ($_ -is [Microsoft.TeamFoundation.Client.TeamFoundationTeam])})]
[SupportsWildcards()]
[object]
$Team = '*',
[Parameter()]
[switch]
$Default,
[Parameter()]
[string]
$NewName,
[Parameter()]
[string]
$Description,
[Parameter()]
[object]
$Project,
[Parameter()]
[object]
$Collection
)
Process
{
$t = Get-TfsTeam -Team $Team -Project $Project -Collection $Collection
if ($Project)
{
$tp = Get-TfsTeamProject -Project $Project -Collection $Collection
$tpc = $tp.Store.TeamProjectCollection
}
else
{
$tpc = Get-TfsTeamProjectCollection -Collection $Collection
}
$teamService = $tpc.GetService([type]'Microsoft.TeamFoundation.Client.TfsTeamService')
if ($NewName)
{
$t.Name = $NewName
}
if ($PSBoundParameters.ContainsKey('Description'))
{
$t.Description = $Description
}
if ($Default)
{
$teamService.SetDefaultTeam($t)
}
$teamService.UpdateTeam($t)
return $t
}
}
Function _GetTeam
{
param
(
[Parameter()]
[string]
$ProjectName,
[Parameter()]
[string]
$Name
)
Begin
{
$tpc = Get-TfsTeamProjectCollection -Current
$teamService = $tpc.GetService([type]"Microsoft.TeamFoundation.Client.TfsTeamService")
}
Process
{
$teamProject = Get-TfsTeamProject $projectName
$team = ($teamService.QueryTeams($teamProject.Uri) | where Name -eq $name)
return $team
}
}
Function _CreateTeam
{
param
(
)
Process
{
$teamService = $tpc.GetService([type]"Microsoft.TeamFoundation.Client.TfsTeamService")
return $teamService.CreateTeam($teamProject.Uri, $Name, $Description, $null)
}
}
Function _SetTeamSettings
{
param
(
$team,
[string[]]
$teamFieldValues
)
}
function _GetTfsTeamSettingsConfigurationService {
Param(
[Microsoft.TeamFoundation.Client.TfsTeamProjectCollection] $TfsCollection
)
return $TfsCollection.GetService([ Microsoft.TeamFoundation.ProcessConfiguration.Client.TeamSettingsConfigurationService]);
}
function _AddTfsTeamField {
Param(
[parameter(Mandatory=$true)][Microsoft.TeamFoundation.Client.TfsTeamProjectCollection] $TfsCollection,
[parameter(Mandatory=$true)][Microsoft.TeamFoundation.Server.ProjectInfo] $TfsTeamProject,
[parameter(Mandatory=$true)][Microsoft.TeamFoundation.Client.TeamFoundationTeam] $TfsTeam,
[parameter(Mandatory=$true)][String] $TeamFieldValue
)
$TfsTeamConfigService = Get-TfsTeamSettingsConfigurationService $TfsCollection
$TfsTeamConfig = $TfsTeamConfigService.GetTeamConfigurations([Guid[]]($TfsTeam.Identity.TeamFoundationId))
$newTeamFieldValue = New-Object Microsoft.TeamFoundation.ProcessConfiguration.Client.TeamFieldValue
$newTeamFieldValue.Value = $TeamFieldValue
$TfsTeamConfig.TeamSettings.TeamFieldValues = [Microsoft.TeamFoundation.ProcessConfiguration.Client.TeamFieldValue[]]($newTeamFieldValue)
$TfsTeamConfig.TeamSettings.BacklogIterationPath = "$($TfsTeamProject.Name)"
#$TfsTeamConfig.TeamSettings.IterationPaths = [string[]]("$($TfsTeamProject.Name)")
$TfsTeamConfigService.SetTeamSettings($TfsTeam.Identity.TeamFoundationId,$TfsTeamConfig.TeamSettings)
}
<#
.SYNOPSIS
Gets information about one or more team projects.
.DESCRIPTION
The Get-TfsTeamProject cmdlets gets one or more Team Project objects (an instance of Microsoft.TeamFoundation.WorkItemTracking.Client.Project) from the supplied Team Project Collection.
.PARAMETER Project
Specifies the name of a Team Project. Wildcards are supported.
.PARAMETER Collection
Specifies either a URL/name of the Team Project Collection to connect to, or a previously initialized TfsTeamProjectCollection object.
When using a URL, it must be fully qualified. The format of this string is as follows:
http[s]://<ComputerName>:<Port>/[<TFS-vDir>/]<CollectionName>
Valid values for the Transport segment of the URI are HTTP and HTTPS. If you specify a connection URI with a Transport segment, but do not specify a port, the session is created with standards ports: 80 for HTTP and 443 for HTTPS.
To connect to a Team Project Collection by using its name, a TfsConfigurationServer object must be supplied either via -Server argument or via a previous call to the Connect-TfsConfigurationServer cmdlet.
For more details, see the Get-TfsTeamProjectCollection cmdlet.
.PARAMETER Server
Specifies either a URL or the name of the Team Foundation Server configuration server (the "root" of a TFS installation) to connect to, or a previously initialized Microsoft.TeamFoundation.Client.TfsConfigurationServer object.
For more details, see the -Server argument in the Get-TfsTeamProjectCollection cmdlet.
.PARAMETER Credential
Specifies a user account that has permission to perform this action. The default is the current user.
Type a user name, such as "User01" or "Domain01\User01", or enter a PSCredential object, such as one generated by the Get-Credential cmdlet. If you type a user name, you will be prompted for a password.
To connect to Visual Studio Online you must enable Alternate Credentials for your user profile and supply that credential in this argument.
For more information on Alternate Credentials for your Visual Studio Online account, please refer to https://msdn.microsoft.com/library/dd286572#setup_basic_auth.
.INPUTS
Microsoft.TeamFoundation.Client.TfsTeamProjectCollection
.NOTES
As with most cmdlets in the TfsCmdlets module, this cmdlet requires a TfsTeamProjectCollection object to be provided via the -Collection argument. If absent, it will default to the connection opened by Connect-TfsTeamProjectCollection.
#>
Function Get-TfsTeamProject
{
[CmdletBinding(DefaultParameterSetName='Get by project')]
[OutputType([Microsoft.TeamFoundation.WorkItemTracking.Client.Project])]
Param
(
[Parameter(Position=0, ParameterSetName='Get by project')]
[object]
$Project = '*',
[Parameter(ValueFromPipeline=$true, Position=1, ParameterSetName='Get by project')]
[object]
$Collection,
[Parameter(Position=0, ParameterSetName="Get current")]
[switch]
$Current,
[Parameter()]
[System.Management.Automation.Credential()]
[System.Management.Automation.PSCredential]
$Credential = [System.Management.Automation.PSCredential]::Empty
)
Process
{
if ($Current)
{
return $global:TfsProjectConnection
}
if ($Project -is [Microsoft.TeamFoundation.WorkItemTracking.Client.Project])
{
return $Project
}
if (($Project -is [uri]) -or ([System.Uri]::IsWellFormedUriString($Project, [System.UriKind]::Absolute)))
{
$tpc = Get-TfsTeamProjectCollection $Collection -Credential $Credential
$css = $tpc.GetService([type]'Microsoft.TeamFoundation.Server.ICommonStructureService')
$projInfo = $css.GetProject([string] $Project)
$Project = $projInfo.Name
}
if ($Project -is [string])
{
$tpc = Get-TfsTeamProjectCollection $Collection -Credential $Credential
$wiStore = $tpc.GetService([type]'Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemStore')
return _GetAllProjects $tpc | ? Name -Like $Project | % { $wiStore.Projects[$_.Name] }
}
if ($Project -eq $null)
{
if ($global:TfsProjectConnection)
{
return $global:TfsProjectConnection
}
}
throw "No TFS team project information available. Either supply a valid -Project argument or use Connect-TfsTeamProject prior to invoking this cmdlet."
}
}
Function _GetAllProjects
{
param ($tpc)
$css = $tpc.GetService([type]'Microsoft.TeamFoundation.Server.ICommonStructureService')
return $css.ListAllProjects() | ? Status -eq WellFormed
}
<#
#>
Function Stop-TfsTeamProjectCollection
{
Param
(
[Parameter(Mandatory=$true, Position=0)]
[object]
$Collection,
[Parameter()]
[string]
$Reason,
[Parameter(ValueFromPipeline=$true)]
[object]
$Server,
[Parameter()]
[System.Management.Automation.Credential()]
[System.Management.Automation.PSCredential]
$Credential = [System.Management.Automation.PSCredential]::Empty
)
Process
{
throw "Not implemented"
}
}
<#
.SYNOPSIS
Detaches a team project collection database from a Team Foundation Server installation.
.PARAMETER Collection
Specifies either a URL/name of the Team Project Collection to connect to, or a previously initialized TfsTeamProjectCollection object.
When using a URL, it must be fully qualified. The format of this string is as follows:
http[s]://<ComputerName>:<Port>/[<TFS-vDir>/]<CollectionName>
Valid values for the Transport segment of the URI are HTTP and HTTPS. If you specify a connection URI with a Transport segment, but do not specify a port, the session is created with standards ports: 80 for HTTP and 443 for HTTPS.
To connect to a Team Project Collection by using its name, a TfsConfigurationServer object must be supplied either via -Server argument or via a previous call to the Connect-TfsConfigurationServer cmdlet.
For more details, see the Get-TfsTeamProjectCollection cmdlet.
#>
Function Dismount-TfsTeamProjectCollection
{
[CmdletBinding(ConfirmImpact="High", SupportsShouldProcess=$true)]
Param
(
[Parameter(Mandatory=$true, Position=0)]
[object]
$Collection,
[Parameter(ValueFromPipeline=$true)]
[object]
$Server,
[Parameter()]
[string]
$Reason,
[Parameter()]
[timespan]
$Timeout = [timespan]::MaxValue,
[Parameter()]
[System.Management.Automation.Credential()]
[System.Management.Automation.PSCredential]
$Credential = [System.Management.Automation.PSCredential]::Empty
)
Process
{
$tpc = Get-TfsTeamProjectCollection -Collection $Collection -Server $Server -Credential $Credential
if ($PSCmdlet.ShouldProcess($tpc.Name, "Detach Project Collection"))
{
$configServer = $tpc.ConfigurationServer
$tpcService = $configServer.GetService([type] 'Microsoft.TeamFoundation.Framework.Client.ITeamProjectCollectionService')
$collectionInfo = $tpcService.GetCollection($tpc.InstanceId)
$connectionString = $null
$tpcJob = $tpcService.QueueDetachCollection($collectionInfo, $null, $Reason, [ref] $connectionString)
$collectionInfo = $tpcService.WaitForCollectionServicingToComplete($tpcJob, $Timeout)
return $connectionString
}
}
}
<#
.SYNOPSIS
Gets one or more Team Project Collection addresses registered in the current computer.
#>
Function Get-TfsRegisteredTeamProjectCollection
{
[CmdletBinding()]
[OutputType([Microsoft.TeamFoundation.Client.RegisteredProjectCollection[]])]
Param
(
[Parameter(Position=0, ValueFromPipeline=$true)]
[SupportsWildcards()]
[string]
$Name = "*"
)
Process
{
return [Microsoft.TeamFoundation.Client.RegisteredTfsConnections]::GetProjectCollections() | ? DisplayName -Like $Name
}
}
<#
.SYNOPSIS
Gets information about one or more team project collections.
.DESCRIPTION
The Get-TfsTeamProject cmdlets gets one or more Team Project Collection objects (an instance of Microsoft.TeamFoundation.Client.TfsTeamProjectCollection) from a TFS instance.
Team Project Collection objects can either be obtained by providing a fully-qualified URL to the collection or by collection name (in which case a TFS Configuration Server object is required).
.PARAMETER Collection
Specifies either a URL/name of the Team Project Collection to connect to, or a previously initialized TfsTeamProjectCollection object.
When using a URL, it must be fully qualified. The format of this string is as follows:
http[s]://<ComputerName>:<Port>/[<TFS-vDir>/]<CollectionName>
Valid values for the Transport segment of the URI are HTTP and HTTPS. If you specify a connection URI with a Transport segment, but do not specify a port, the session is created with standards ports: 80 for HTTP and 443 for HTTPS.
To connect to a Team Project Collection by using its name, a TfsConfigurationServer object must be supplied either via -Server argument or via a previous call to the Connect-TfsConfigurationServer cmdlet.
For more details, see the Get-TfsTeamProjectCollection cmdlet.
.PARAMETER Server
Specifies either a URL/name of the Team Foundation Server configuration server (the "root" of a TFS installation) to connect to, or a previously initialized Microsoft.TeamFoundation.Client.TfsConfigurationServer object.
.PARAMETER Credential
Specifies a user account that has permission to perform this action. The default is the current user.
Type a user name, such as "User01" or "Domain01\User01", or enter a PSCredential object, such as one generated by the Get-Credential cmdlet. If you type a user name, you will be prompted for a password.
To connect to Visual Studio Online you must enable Alternate Credentials for your user profile and supply that credential in this argument.
For more information on Alternate Credentials for your Visual Studio Online account, please refer to https://msdn.microsoft.com/library/dd286572#setup_basic_auth.
.EXAMPLE
Get-TfsTeamProjectCollection http://
.INPUTS
Microsoft.TeamFoundation.Client.TfsConfigurationServer
.NOTES
Cmdlets in the TfsCmdlets module that operate on a collection level require a TfsConfigurationServer object to be provided via the -Server argument. If absent, it will default to the connection opened by Connect-TfsConfigurationServer.
#>
Function Get-TfsTeamProjectCollection
{
[CmdletBinding(DefaultParameterSetName='Get by collection')]
[OutputType([Microsoft.TeamFoundation.Client.TfsTeamProjectCollection])]
Param
(
[Parameter(Position=0, ParameterSetName="Get by collection")]
[SupportsWildcards()]
[object]
$Collection = "*",
[Parameter(ValueFromPipeline=$true, ParameterSetName="Get by collection")]
[object]
$Server,
[Parameter(Position=0, ParameterSetName="Get current")]
[switch]
$Current,
[Parameter(ParameterSetName="Get by collection")]
[System.Management.Automation.Credential()]
[System.Management.Automation.PSCredential]
$Credential = [System.Management.Automation.PSCredential]::Empty
)
Process
{
if ($Current)
{
return $Global:TfsTpcConnection
}
if ($Collection -is [Microsoft.TeamFoundation.Client.TfsTeamProjectCollection])
{
return $Collection
}
if ($Collection -is [Uri])
{
return _GetCollectionFromUrl $Collection $Credential
}
if ($Collection -is [string])
{
if ([Uri]::IsWellFormedUriString($Collection, [UriKind]::Absolute))
{
return _GetCollectionFromUrl ([Uri] $Collection) $Credential
}
if (-not [string]::IsNullOrWhiteSpace($Collection))
{
return _GetCollectionFromName $Collection $Server $Credential
}
$Collection = $null
}
if ($Collection -eq $null)
{
if ($Global:TfsTpcConnection)
{
return $Global:TfsTpcConnection
}
}
throw "No TFS connection information available. Either supply a valid -Collection argument or use Connect-TfsTeamProjectCollection prior to invoking this cmdlet."
}
}
# =================
# Helper Functions
# =================
Function _GetCollectionFromUrl($Url, $Cred)
{
if ($Cred -ne [System.Management.Automation.PSCredential]::Empty)
{
return New-Object Microsoft.TeamFoundation.Client.TfsTeamProjectCollection -ArgumentList $Url, (_GetCredential $cred)
}
return [Microsoft.TeamFoundation.Client.TfsTeamProjectCollectionFactory]::GetTeamProjectCollection([Uri] $Url)
}
Function _GetCollectionFromName($Name, $Server, $Cred)
{
Process
{
$configServer = Get-TfsConfigurationServer $Server -Credential $Cred
$filter = [Guid[]] @([Microsoft.TeamFoundation.Framework.Common.CatalogResourceTypes]::ProjectCollection)
$collections = $configServer.CatalogNode.QueryChildren($filter, $false, [Microsoft.TeamFoundation.Framework.Common.CatalogQueryOptions]::IncludeParents)
$collections = $collections | Select -ExpandProperty Resource | ? DisplayName -like $Name
if ($collections.Count -eq 0)
{
throw "Invalid or non-existent Team Project Collection(s): $Name"
}
foreach($tpc in $collections)
{
$collectionId = $tpc.Properties["InstanceId"]
$tpc = $configServer.GetTeamProjectCollection($collectionId)
$tpc
}
}
}
Function _GetCredential
{
Param ($Cred)
if (($Cred -ne $null) -and ($Cred -ne [System.Management.Automation.PSCredential]::Empty))
{
return [System.Net.NetworkCredential] $Cred
}
return [System.Net.CredentialCache]::DefaultNetworkCredentials
}<#
.SYNOPSIS
Attaches a team project collection database to a Team Foundation Server installation.
#>
Function Mount-TfsTeamProjectCollection
{
Param
(
[Parameter(Mandatory=$true, Position=0)]
[string]
$Name,
[Parameter()]
[string]
$Description,
[Parameter(ParameterSetName="Use database server", Mandatory=$true)]
[string]
$DatabaseServer,
[Parameter(ParameterSetName="Use database server", Mandatory=$true)]
[string]
$DatabaseName,
[Parameter(ParameterSetName="Use connection string", Mandatory=$true)]
[string]
$ConnectionString,
[Parameter()]
[ValidateSet("Started", "Stopped")]
[string]
$InitialState = "Started",
[Parameter()]
[switch]
$Clone,
[Parameter()]
[int]
$PollingInterval = 5,
[Parameter()]
[timespan]
$Timeout = [timespan]::MaxValue,
[Parameter(ValueFromPipeline=$true)]
[object]
$Server,
[Parameter()]
[System.Management.Automation.Credential()]
[System.Management.Automation.PSCredential]
$Credential = [System.Management.Automation.PSCredential]::Empty
)
Process
{
$configServer = Get-TfsConfigurationServer $Server -Credential $Credential
$tpcService = $configServer.GetService([type] 'Microsoft.TeamFoundation.Framework.Client.ITeamProjectCollectionService')
$servicingTokens = New-Object 'System.Collections.Generic.Dictionary[string,string]'
if ($DatabaseName)
{
$servicingTokens["CollectionDatabaseName"] = $DatabaseName
}
if ($PSCmdlet.ParameterSetName -eq "Use database server")
{
$ConnectionString = "Data source=$DatabaseServer; Integrated Security=true; Initial Catalog=$DatabaseName"
}
try
{
Write-Progress -Id 1 -Activity "Attach team project collection" -Status "Attaching team project collection $Name" -PercentComplete 0
$start = Get-Date
# string databaseConnectionString, IDictionary<string, string> servicingTokens, bool cloneCollection, string name, string description, string virtualDirectory)
$tpcJob = $tpcService.QueueAttachCollection(
$ConnectionString,
$servicingTokens,
$Clone.ToBool(),
$Name,
$Description,
"~/$Name/")
[void] $tpcService.WaitForCollectionServicingToComplete($tpcJob, $Timeout)
return Get-TfsTeamProjectCollection -Server $Server -Credential $Credential -Collection $Name
}
finally
{
Write-Progress -Id 1 -Activity "Attach team project collection" -Completed
}
throw (New-Object 'System.TimeoutException' -ArgumentList "Operation timed out during creation of team project collection $Name")
}
}
<#
.SYNOPSIS
Creates a new team project collection.
#>
Function New-TfsTeamProjectCollection
{
Param
(
[Parameter(Mandatory=$true, Position=0)]
[string]
$Name,
[Parameter()]
[string]
$Description,
[Parameter(ParameterSetName="Use database server", Mandatory=$true)]
[string]
$DatabaseServer,
[Parameter(ParameterSetName="Use database server")]
[string]
$DatabaseName,
[Parameter(ParameterSetName="Use connection string", Mandatory=$true)]
[string]
$ConnectionString,
[Parameter()]
[switch]
$Default,
[Parameter()]
[switch]
$UseExistingDatabase,
[Parameter()]
[ValidateSet("Started", "Stopped")]
[string]
$InitialState = "Started",
[Parameter()]
[int]
$PollingInterval = 5,
[Parameter()]
[timespan]
$Timeout = [timespan]::MaxValue,
[Parameter(ValueFromPipeline=$true)]
[object]
$Server,
[Parameter()]
[System.Management.Automation.Credential()]
[System.Management.Automation.PSCredential]
$Credential = [System.Management.Automation.PSCredential]::Empty
)
Process
{
$configServer = Get-TfsConfigurationServer $Server -Credential $Credential
$tpcService = $configServer.GetService([type] 'Microsoft.TeamFoundation.Framework.Client.ITeamProjectCollectionService')
$servicingTokens = New-Object 'System.Collections.Generic.Dictionary[string,string]'
$servicingTokens["SharePointAction"] = "None"
$servicingTokens["ReportingAction"] = "None"
if ($DatabaseName)
{
$servicingTokens["CollectionDatabaseName"] = $DatabaseName
}
if ($UseExistingDatabase)
{
$servicingTokens["UseExistingDatabase"] = $UseExistingDatabase.ToBool()
}
if ($PSCmdlet.ParameterSetName -eq "Use database server")
{
$ConnectionString = "Data source=$DatabaseServer; Integrated Security=true"
}
try
{
Write-Progress -Id 1 -Activity "Create team project collection" -Status "Creating team project collection $Name" -PercentComplete 0
$start = Get-Date
$tpcJob = $tpcService.QueueCreateCollection(
$Name,
$Description,
$Default.ToBool(),
"~/$Name/",
[Microsoft.TeamFoundation.Framework.Common.TeamFoundationServiceHostStatus] $InitialState,
$servicingTokens,
$ConnectionString,
$null, # Default connection string
$null) # Default category connection strings
while((Get-Date).Subtract($start) -le $Timeout)
{
Start-Sleep -Seconds $PollingInterval
$collectionInfo = $tpcService.GetCollection($tpcJob.HostId, [Microsoft.TeamFoundation.Framework.Client.ServiceHostFilterFlags]::IncludeAllServicingDetails)
$jobDetail = $collectionInfo.ServicingDetails | ? JobId -eq $tpcJob.JobId
if (($jobDetail -eq $null) -or
(($jobDetail.JobStatus -ne [Microsoft.TeamFoundation.Framework.Client.ServicingJobStatus]::Queued) -and
($jobDetail.JobStatus -ne [Microsoft.TeamFoundation.Framework.Client.ServicingJobStatus]::Running)))
{
if ($jobDetail.Result -eq [Microsoft.TeamFoundation.Framework.Client.ServicingJobResult]::Failed -or
$jobDetail.JobStatus -eq [Microsoft.TeamFoundation.Framework.Client.ServicingJobStatus]::Failed)
{
throw "Error creating team project collection $Name : "
}
return Get-TfsTeamProjectCollection -Server $Server -Credential $Credential -Collection $Name
}
}
}
finally
{
Write-Progress -Id 1 -Activity "Create team project collection" -Completed
}
throw (New-Object 'System.TimeoutException' -ArgumentList "Operation timed out during creation of team project collection $Name")
}
}
<#
.SYNOPSIS
Deletes a team project collection
#>
Function Remove-TfsTeamProjectCollection
{
[CmdletBinding(ConfirmImpact="High", SupportsShouldProcess=$true)]
Param
(
[Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)]
[object]
$Collection,
[Parameter()]
[object]
$Server,
[Parameter()]
[timespan]
$Timeout = [timespan]::MaxValue,
[Parameter()]
[System.Management.Automation.Credential()]
[System.Management.Automation.PSCredential]
$Credential = [System.Management.Automation.PSCredential]::Empty
)
Process
{
$tpc = Get-TfsTeamProjectCollection -Collection $Collection -Server $Server -Credential $Credential
if ($PSCmdlet.ShouldProcess($tpc.Name, "Delete Team Project Collection"))
{
Write-Progress -Id 1 -Activity "Delete team project collection" -Status "Deleting $($tpc.Name)" -PercentComplete 0
try
{
$configServer = $tpc.ConfigurationServer
$tpcService = $configServer.GetService([type] 'Microsoft.TeamFoundation.Framework.Client.ITeamProjectCollectionService')
$collectionInfo = $tpcService.GetCollection($tpc.InstanceId)
$collectionInfo.Delete()
}
finally
{
Write-Progress -Id 1 -Activity "Delete team project collection" -Completed
}
}
}
}
Set-Alias tfsrv Connect-TfsConfigurationServer
Set-Alias tftpc Connect-TfsTeamProjectCollection
Set-Alias tftp Connect-TfsTeamProject
Set-Alias gtftpc Get-TfsTeamProjectCollection
Set-Alias gtftp Get-TfsTeamProject
<#
.SYNOPSIS
Gets the history of changes of a work item.
.PARAMETER Collection
Specifies either a URL/name of the Team Project Collection to connect to, or a previously initialized TfsTeamProjectCollection object.
When using a URL, it must be fully qualified. The format of this string is as follows:
http[s]://<ComputerName>:<Port>/[<TFS-vDir>/]<CollectionName>
Valid values for the Transport segment of the URI are HTTP and HTTPS. If you specify a connection URI with a Transport segment, but do not specify a port, the session is created with standards ports: 80 for HTTP and 443 for HTTPS.
To connect to a Team Project Collection by using its name, a TfsConfigurationServer object must be supplied either via -Server argument or via a previous call to the Connect-TfsConfigurationServer cmdlet.
For more details, see the Get-TfsTeamProjectCollection cmdlet.
.EXAMPLE
Get-TfsWorkItem -Filter '[System.WorkItemType] = "Task"' | % { Write-Output "WI $($_.Id): $($_.Title)"; Get-TfsWorkItemHistory -WorkItem $_ }
#>
Function Get-TfsWorkItemHistory
{
[CmdletBinding()]
Param
(
[Parameter(Position=0, Mandatory=$true, ValueFromPipeline=$true)]
[Alias("id")]
[ValidateNotNull()]
[object]
$WorkItem,
[Parameter()]
[object]
$Collection
)
Process
{
$wi = Get-TfsWorkItem -WorkItem $WorkItem -Collection $Collection
$latestRev = $wi.Revisions.Count - 1
0..$latestRev | % {
$rev = $wi.Revisions[$_]
[PSCustomObject] @{
Revision = $_ + 1;
ChangedDate = $rev.Fields['System.ChangedDate'].Value
ChangedBy = $rev.Fields['System.ChangedBy'].Value
Changes = _GetChangedFields $wi $_
}
}
}
}
Function _GetChangedFields([Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItem] $wi, [int] $rev)
{
$result = @{}
$wi.Revisions[$rev].Fields | ? IsChangedInRevision -eq $true | % {
$result[$_.ReferenceName] = [PSCustomObject] @{
NewValue = $_.Value;
OriginalValue = $_.OriginalValue
}
}
return $result
}
<#
.SYNOPSIS
Exports a work item type definition from a team project to XML.
.PARAMETER Name
Uses this parameter to filter for an specific Work Item Type.
If suppress, cmdlet will return all Work Item Types on XML format.
.PARAMETER IncludeGlobalLists
Exports the definitions of referenced global lists. If not specified, global list definitions are omitted.
.PARAMETER Project
Specifies either the name of the Team Project or a previously initialized Microsoft.TeamFoundation.WorkItemTracking.Client.Project object to connect to. If omitted, it defaults to the connection opened by Connect-TfsTeamProject (if any).
For more details, see the Get-TfsTeamProject cmdlet.
.PARAMETER Collection
Specifies either a URL/name of the Team Project Collection to connect to, or a previously initialized TfsTeamProjectCollection object.
When using a URL, it must be fully qualified. The format of this string is as follows:
http[s]://<ComputerName>:<Port>/[<TFS-vDir>/]<CollectionName>
Valid values for the Transport segment of the URI are HTTP and HTTPS. If you specify a connection URI with a Transport segment, but do not specify a port, the session is created with standards ports: 80 for HTTP and 443 for HTTPS.
To connect to a Team Project Collection by using its name, a TfsConfigurationServer object must be supplied either via -Server argument or via a previous call to the Connect-TfsConfigurationServer cmdlet.
For more details, see the Get-TfsTeamProjectCollection cmdlet.
#>
Function Export-TfsWorkItemType
{
[CmdletBinding()]
[OutputType([xml[]])]
Param
(
[Parameter()]
[SupportsWildcards()]
[string]
$Name = "*",
[Parameter()]
[switch]
$IncludeGlobalLists,
[Parameter(ValueFromPipeline=$true)]
[object]
$Project,
[Parameter()]
[object]
$Collection
)
Process
{
$types = Get-TfsWorkItemType -Name $Name -Project $Project -Collection $Collection
foreach($type in $types)
{
$type.Export($IncludeGlobalLists)
}
}
}
<#
.SYNOPSIS
Gets the contents of one or more work items.
.PARAMETER Project
Specifies either the name of the Team Project or a previously initialized Microsoft.TeamFoundation.WorkItemTracking.Client.Project object to connect to. If omitted, it defaults to the connection opened by Connect-TfsTeamProject (if any).
For more details, see the Get-TfsTeamProject cmdlet.
.PARAMETER Collection
Specifies either a URL/name of the Team Project Collection to connect to, or a previously initialized TfsTeamProjectCollection object.
When using a URL, it must be fully qualified. The format of this string is as follows:
http[s]://<ComputerName>:<Port>/[<TFS-vDir>/]<CollectionName>
Valid values for the Transport segment of the URI are HTTP and HTTPS. If you specify a connection URI with a Transport segment, but do not specify a port, the session is created with standards ports: 80 for HTTP and 443 for HTTPS.
To connect to a Team Project Collection by using its name, a TfsConfigurationServer object must be supplied either via -Server argument or via a previous call to the Connect-TfsConfigurationServer cmdlet.
For more details, see the Get-TfsTeamProjectCollection cmdlet.
#>
Function Get-TfsWorkItem
{
[CmdletBinding(DefaultParameterSetName="Query by text")]
Param
(
[Parameter(Position=0, Mandatory=$true, ParameterSetName="Query by revision")]
[Parameter(Position=0, Mandatory=$true, ParameterSetName="Query by date")]
[Alias("id")]
[ValidateNotNull()]
[object]
$WorkItem,
[Parameter(ParameterSetName="Query by revision")]
[Alias("rev")]
[int]
$Revision,
[Parameter(Mandatory=$true, ParameterSetName="Query by date")]
[datetime]
$AsOf,
[Parameter(Mandatory=$true, ParameterSetName="Query by WIQL")]
[Alias('WIQL')]
[string]
$QueryText,
[Parameter(Mandatory=$true, ParameterSetName="Query by saved query")]
[string]
$StoredQueryPath,
[Parameter(Mandatory=$true, ParameterSetName="Query by filter")]
[string]
$Filter,
[Parameter(Position=0, Mandatory=$true, ParameterSetName="Query by text")]
[string]
$Text,
[Parameter()]
[hashtable]
$Macros,
[Parameter(ValueFromPipeline=$true)]
[object]
$Project,
[Parameter()]
[object]
$Collection
)
Process
{
if ($Project)
{
$tp = Get-TfsTeamProject -Project $Project -Collection $Collection
$tpc = $tp.Store.TeamProjectCollection
$store = $tp.Store
}
else
{
$tpc = Get-TfsTeamProjectCollection -Collection $Collection
$store = $tpc.GetService([type]'Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemStore')
}
if ($WorkItem -is [Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItem])
{
if ((-Not $Revision) -and (-Not $AsOf))
{
return $WorkItem
}
}
switch($PSCmdlet.ParameterSetName)
{
"Query by revision" {
return _GetWorkItemByRevision $WorkItem $Revision $store
}
"Query by date" {
return _GetWorkItemByDate $WorkItem $AsOf $store
}
"Query by text" {
$localMacros = @{TfsQueryText=$Text}
$Wiql = "SELECT * FROM WorkItems WHERE [System.Title] CONTAINS @TfsQueryText OR [System.Description] CONTAINS @TfsQueryText"
return _GetWorkItemByWiql $Wiql $localMacros $tp $store
}
"Query by filter" {
$Wiql = "SELECT * FROM WorkItems WHERE $Filter"
return _GetWorkItemByWiql $Wiql $Macros $tp $store
}
"Query by WIQL" {
return _GetWorkItemByWiql $QueryText $Macros $tp $store
}
"Query by saved query" {
return _GetWorkItemBySavedQuery $StoredQueryPath $Macros $tp $store
}
}
}
}
Function _GetWorkItemByRevision($WorkItem, $Revision, $store)
{
if ($WorkItem -is [Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItem])
{
$ids = @($WorkItem.Id)
}
elseif ($WorkItem -is [int])
{
$ids = @($WorkItem)
}
elseif ($WorkItem -is [int[]])
{
$ids = $WorkItem
}
else
{
throw "Invalid work item ""$WorkItem"". Supply either a WorkItem object or one or more integer ID numbers"
}
if ($Revision -is [int] -and $Revision -gt 0)
{
foreach($id in $ids)
{
$store.GetWorkItem($id, $Revision)
}
}
elseif ($Revision -is [int[]])
{
if ($ids.Count -ne $Revision.Count)
{
throw "When supplying a list of IDs and Revisions, both must have the same number of elements"
}
for($i = 0; $i -le $ids.Count-1; $i++)
{
$store.GetWorkItem($ids[$i], $Revision[$i])
}
}
else
{
foreach($id in $ids)
{
$store.GetWorkItem($id)
}
}
}
Function _GetWorkItemByDate($WorkItem, $AsOf, $store)
{
if ($WorkItem -is [Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItem])
{
$ids = @($WorkItem.Id)
}
elseif ($WorkItem -is [int])
{
$ids = @($WorkItem)
}
elseif ($WorkItem -is [int[]])
{
$ids = $WorkItem
}
else
{
throw "Invalid work item ""$WorkItem"". Supply either a WorkItem object or one or more integer ID numbers"
}
if ($AsOf -is [datetime[]])
{
if ($ids.Count -ne $AsOf.Count)
{
throw "When supplying a list of IDs and Changed Dates (AsOf), both must have the same number of elements"
}
for($i = 0; $i -le $ids.Count-1; $i++)
{
$store.GetWorkItem($ids[$i], $AsOf[$i])
}
}
else
{
foreach($id in $ids)
{
$store.GetWorkItem($id, $AsOf)
}
}
}
Function _GetWorkItemByWiql($QueryText, $Macros, $Project, $store)
{
if (-not $Macros)
{
$Macros = @{}
}
if (($QueryText -match "@project") -and $Project)
{
if (-not $Macros.ContainsKey("Project"))
{
$Macros["Project"] = $Project.Name
}
}
if ($QueryText -match "@me")
{
$user = $null
$store.TeamProjectCollection.GetAuthenticatedIdentity([ref] $user)
$Macros["Me"] = $user.DisplayName
}
$wis = $store.Query($QueryText, $Macros)
foreach($wi in $wis)
{
$wi
}
}
Function _GetWorkItemBySavedQuery($StoredQueryPath, $Macros, $Project, $store)
{
throw New-Object 'System.NotImplementedException'
}
<#
.SYNOPSIS
Gets one or more Work Item Type definitions from a team project.
.PARAMETER Name
Uses this parameter to filter for an specific Work Item Type.
If suppress, cmdlet will show all Work Item Types.
.PARAMETER Project
Specifies either the name of the Team Project or a previously initialized Microsoft.TeamFoundation.WorkItemTracking.Client.Project object to connect to. If omitted, it defaults to the connection opened by Connect-TfsTeamProject (if any).
For more details, see the Get-TfsTeamProject cmdlet.
.PARAMETER Collection
Specifies either a URL/name of the Team Project Collection to connect to, or a previously initialized TfsTeamProjectCollection object.
When using a URL, it must be fully qualified. The format of this string is as follows:
http[s]://<ComputerName>:<Port>/[<TFS-vDir>/]<CollectionName>
Valid values for the Transport segment of the URI are HTTP and HTTPS. If you specify a connection URI with a Transport segment, but do not specify a port, the session is created with standards ports: 80 for HTTP and 443 for HTTPS.
To connect to a Team Project Collection by using its name, a TfsConfigurationServer object must be supplied either via -Server argument or via a previous call to the Connect-TfsConfigurationServer cmdlet.
For more details, see the Get-TfsTeamProjectCollection cmdlet.
.EXAMPLE
Get-TfsWorkItemType -Name "Task" -Project "My Team Project"
Get informations about Work Item Type "Task" of a team project name "My Team Project"
.EXAMPLE
Get-TfsWorkItemType -Project "My Team Project"
Get all Work Item Types of a team project name "My Team Project"
#>
Function Get-TfsWorkItemType
{
[CmdletBinding()]
[OutputType([Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemType[]])]
Param
(
[Parameter(Position=0)]
[SupportsWildcards()]
[Alias("Name")]
[string]
$Type = "*",
[Parameter(ValueFromPipeline=$true)]
[object]
$Project,
[Parameter()]
[object]
$Collection
)
Process
{
if ($Type -is [Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemType])
{
return $Type
}
$tp = Get-TfsTeamProject -Project $Project -Collection $Collection
return $tp.WorkItemTypes | ? Name -Like $Type
}
}
<#
.SYNOPSIS
Imports a work item type definition to a team project from XML.
.PARAMETER Project
Specifies either the name of the Team Project or a previously initialized Microsoft.TeamFoundation.WorkItemTracking.Client.Project object to connect to. If omitted, it defaults to the connection opened by Connect-TfsTeamProject (if any).
For more details, see the Get-TfsTeamProject cmdlet.
.PARAMETER Collection
Specifies either a URL/name of the Team Project Collection to connect to, or a previously initialized TfsTeamProjectCollection object.
When using a URL, it must be fully qualified. The format of this string is as follows:
http[s]://<ComputerName>:<Port>/[<TFS-vDir>/]<CollectionName>
Valid values for the Transport segment of the URI are HTTP and HTTPS. If you specify a connection URI with a Transport segment, but do not specify a port, the session is created with standards ports: 80 for HTTP and 443 for HTTPS.
To connect to a Team Project Collection by using its name, a TfsConfigurationServer object must be supplied either via -Server argument or via a previous call to the Connect-TfsConfigurationServer cmdlet.
For more details, see the Get-TfsTeamProjectCollection cmdlet.
#>
Function Import-TfsWorkItemType
{
[CmdletBinding()]
[OutputType([Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemType[]])]
Param
(
[Parameter(Position=0)]
[xml]
$Xml,
[Parameter(ValueFromPipeline=$true)]
[object]
$Project,
[Parameter()]
[object]
$Collection
)
Process
{
$tp = Get-TfsTeamProject $Project $Collection
return $tp.WorkItemTypes | ? Name -Like $Name
}
}
<#
.SYNOPSIS
Creates a new work item in a team project.
.PARAMETER Type
Represents the name of the work item type to create.
.PARAMETER Title
Specifies a Title field of new work item type that will be created.
.PARAMETER Fields
Specifies the fields that are changed and the new values to give to them.
FieldN The name of a field to update.
ValueN The value to set on the fieldN.
[field1=value1[;field2=value2;...]
.PARAMETER Project
Specifies either the name of the Team Project or a previously initialized Microsoft.TeamFoundation.WorkItemTracking.Client.Project object to connect to. If omitted, it defaults to the connection opened by Connect-TfsTeamProject (if any).
For more details, see the Get-TfsTeamProject cmdlet.
.PARAMETER Collection
Specifies either a URL/name of the Team Project Collection to connect to, or a previously initialized TfsTeamProjectCollection object.
When using a URL, it must be fully qualified. The format of this string is as follows:
http[s]://<ComputerName>:<Port>/[<TFS-vDir>/]<CollectionName>
Valid values for the Transport segment of the URI are HTTP and HTTPS. If you specify a connection URI with a Transport segment, but do not specify a port, the session is created with standards ports: 80 for HTTP and 443 for HTTPS.
To connect to a Team Project Collection by using its name, a TfsConfigurationServer object must be supplied either via -Server argument or via a previous call to the Connect-TfsConfigurationServer cmdlet.
For more details, see the Get-TfsTeamProjectCollection cmdlet.
.EXAMPLE
New-TfsWorkItem -Type Task -Title "Task 1" -Project "MyTeamProject"
This example creates a new Work Item on Team Project "MyTeamProject".
#>
Function New-TfsWorkItem
{
[CmdletBinding()]
[OutputType([Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItem])]
Param
(
[Parameter(ValueFromPipeline=$true, Mandatory=$true, Position=0)]
[object]
$Type,
[Parameter(Position=1)]
[string]
$Title,
[Parameter()]
[hashtable]
$Fields,
[Parameter()]
[object]
$Project,
[Parameter()]
[object]
$Collection
)
Process
{
$wit = Get-TfsWorkItemType -Type $Type -Project $Project -Collection $Collection
$wi = $wit.NewWorkItem()
if ($Title)
{
$wi.Title = $Title
}
foreach($field in $Fields)
{
$wi.Fields[$field.Key] = $field.Value
}
$wi.Save()
return $wi
}
}
<#
.SYNOPSIS
Deletes a work item from a team project collection.
.PARAMETER Collection
Specifies either a URL/name of the Team Project Collection to connect to, or a previously initialized TfsTeamProjectCollection object.
When using a URL, it must be fully qualified. The format of this string is as follows:
http[s]://<ComputerName>:<Port>/[<TFS-vDir>/]<CollectionName>
Valid values for the Transport segment of the URI are HTTP and HTTPS. If you specify a connection URI with a Transport segment, but do not specify a port, the session is created with standards ports: 80 for HTTP and 443 for HTTPS.
To connect to a Team Project Collection by using its name, a TfsConfigurationServer object must be supplied either via -Server argument or via a previous call to the Connect-TfsConfigurationServer cmdlet.
For more details, see the Get-TfsTeamProjectCollection cmdlet.
#>
Function Remove-TfsWorkItem
{
[CmdletBinding(ConfirmImpact="High", SupportsShouldProcess=$true)]
Param
(
[Parameter(Position=0, Mandatory=$true, ValueFromPipeline=$true)]
[Alias("id")]
[ValidateNotNull()]
[object]
$WorkItem,
[Parameter()]
[object]
$Collection
)
Process
{
$ids = @()
foreach($wi in $WorkItem)
{
if ($WorkItem -is [Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItem])
{
$id = $WorkItem.Id
}
elseif ($WorkItem -is [int])
{
$id = $WorkItem
}
else
{
throw "Invalid work item ""$WorkItem"". Supply either a WorkItem object or one or more integer ID numbers"
}
if ($PSCmdlet.ShouldProcess("ID: $id", "Destroy workitem"))
{
$ids += $id
}
}
if ($ids.Count -gt 0)
{
$tpc = Get-TfsTeamProjectCollection $Collection
$store = $tpc.GetService([type] "Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemStore")
$errors = $store.DestroyWorkItems([int[]] $ids)
if ($errors -and ($errors.Count -gt 0))
{
$errors | Write-Error "Error $($_.Id): $($_.Exception.Message)"
throw "Error destroying one or more work items"
}
}
}
}
<#
.SYNOPSIS
Gets information about one or more XAML Build agents.
.PARAMETER Collection
Specifies either a URL/name of the Team Project Collection to connect to, or a previously initialized TfsTeamProjectCollection object.
When using a URL, it must be fully qualified. The format of this string is as follows:
http[s]://<ComputerName>:<Port>/[<TFS-vDir>/]<CollectionName>
Valid values for the Transport segment of the URI are HTTP and HTTPS. If you specify a connection URI with a Transport segment, but do not specify a port, the session is created with standards ports: 80 for HTTP and 443 for HTTPS.
To connect to a Team Project Collection by using its name, a TfsConfigurationServer object must be supplied either via -Server argument or via a previous call to the Connect-TfsConfigurationServer cmdlet.
For more details, see the Get-TfsTeamProjectCollection cmdlet.
#>
Function Get-TfsXamlBuildAgent
{
[CmdletBinding()]
[OutputType([Microsoft.TeamFoundation.Build.Client.IBuildAgent])]
Param
(
[Parameter(Position=0)]
[ValidateScript({$_ -is [string] -or $_ -is [Microsoft.TeamFoundation.Build.Client.IBuildAgent]})]
[ValidateNotNullOrEmpty()]
[Alias("Name")]
[object]
$BuildAgent = "*",
[Parameter(Position=0, ValueFromPipeline=$true)]
[ValidateScript({$_ -is [string] -or $_ -is [Microsoft.TeamFoundation.Build.Client.IBuildController]})]
[ValidateNotNullOrEmpty()]
[Alias("Controller")]
[object]
$BuildController = "*",
[Parameter()]
[object]
$Collection
)
Process
{
if ($BuildAgent -is [Microsoft.TeamFoundation.Build.Client.IBuildAgent])
{
return $BuildAgent
}
$controllers = Get-TfsXamlBuildController -BuildController $BuildController -Collection $Collection
foreach($controller in $controllers)
{
$controller.Agents | Where Name -Like $BuildAgent
}
}
}
<#
.SYNOPSIS
Gets information about one or more XAML Build controllers.
.PARAMETER Collection
Specifies either a URL/name of the Team Project Collection to connect to, or a previously initialized TfsTeamProjectCollection object.
When using a URL, it must be fully qualified. The format of this string is as follows:
http[s]://<ComputerName>:<Port>/[<TFS-vDir>/]<CollectionName>
Valid values for the Transport segment of the URI are HTTP and HTTPS. If you specify a connection URI with a Transport segment, but do not specify a port, the session is created with standards ports: 80 for HTTP and 443 for HTTPS.
To connect to a Team Project Collection by using its name, a TfsConfigurationServer object must be supplied either via -Server argument or via a previous call to the Connect-TfsConfigurationServer cmdlet.
For more details, see the Get-TfsTeamProjectCollection cmdlet.
#>
Function Get-TfsXamlBuildController
{
[CmdletBinding()]
[OutputType([Microsoft.TeamFoundation.Build.Client.IBuildController])]
Param
(
[Parameter(Position=0)]
[ValidateScript({$_ -is [string] -or $_ -is [Microsoft.TeamFoundation.Build.Client.IBuildController]})]
[ValidateNotNullOrEmpty()]
[Alias("Name")]
[object]
$BuildController = "*",
[Parameter(ValueFromPipeline=$true)]
[object]
$Collection
)
Process
{
if ($BuildController -is [Microsoft.TeamFoundation.Build.Client.IBuildController])
{
return $BuildController
}
$tpc = Get-TfsTeamProjectCollection $Collection
$buildServer = $tpc.GetService([type]'Microsoft.TeamFoundation.Build.Client.IBuildServer')
$buildControllers = $buildServer.QueryBuildControllers()
return $buildControllers | Where Name -Like $BuildController
}
}
<#
.SYNOPSIS
Gets one or more XAML Build definitions.
.PARAMETER BuildDefinition
Uses this parameter to filter for an specific Build Defintion.
If suppress, cmdlet will show all queue builds.
.PARAMETER Project
Specifies either the name of the Team Project or a previously initialized Microsoft.TeamFoundation.WorkItemTracking.Client.Project object to connect to. If omitted, it defaults to the connection opened by Connect-TfsTeamProject (if any).
For more details, see the Get-TfsTeamProject cmdlet.
.PARAMETER Collection
Specifies either a URL/name of the Team Project Collection to connect to, or a previously initialized TfsTeamProjectCollection object.
When using a URL, it must be fully qualified. The format of this string is as follows:
http[s]://<ComputerName>:<Port>/[<TFS-vDir>/]<CollectionName>
Valid values for the Transport segment of the URI are HTTP and HTTPS. If you specify a connection URI with a Transport segment, but do not specify a port, the session is created with standards ports: 80 for HTTP and 443 for HTTPS.
To connect to a Team Project Collection by using its name, a TfsConfigurationServer object must be supplied either via -Server argument or via a previous call to the Connect-TfsConfigurationServer cmdlet.
For more details, see the Get-TfsTeamProjectCollection cmdlet.
.EXAMPLE
Get-TfsBuildQueue -BuildDefinition "My Build Definition" -Project "My Team Project"
Get all queued builds given a definition name and a team project name
.EXAMPLE
Get-TfsBuildQueue
Get all queued builds, regardless of definition name or team project name
#>
Function Get-TfsXamlBuildDefinition
{
[CmdletBinding()]
[OutputType([Microsoft.TeamFoundation.Build.Client.IBuildDefinition])]
Param
(
[Parameter(Position=0)]
[ValidateScript({$_ -is [string] -or $_ -is [Microsoft.TeamFoundation.Build.Client.IBuildDefinition]})]
[ValidateNotNullOrEmpty()]
[Alias("Name")]
[object]
$BuildDefinition = "*",
[Parameter(ValueFromPipeline=$true)]
[object]
$Project,
[Parameter()]
[object]
$Collection
)
Process
{
if ($BuildDefinition -is [Microsoft.TeamFoundation.Build.Client.IBuildDefinition])
{
return $BuildDefinition
}
$tp = Get-TfsTeamProject $Project $Collection
$tpName = $tp.Name
$tpc = $tp.Store.TeamProjectCollection
$buildServer = $tpc.GetService([type]'Microsoft.TeamFoundation.Build.Client.IBuildServer')
$buildDefs = $buildServer.QueryBuildDefinitions($tpName)
return $buildDefs | Where Name -Like $BuildDefinition
}
}
<#
.SYNOPSIS
Gets information about queued XAML Builds.
.PARAMETER BuildDefinition
Uses this parameter to filter for an specific Build Defintion.
If suppress, cmdlet will show all queue builds.
.PARAMETER Project
Specifies either the name of the Team Project or a previously initialized Microsoft.TeamFoundation.WorkItemTracking.Client.Project object to connect to. If omitted, it defaults to the connection opened by Connect-TfsTeamProject (if any).
For more details, see the Get-TfsTeamProject cmdlet.
.PARAMETER Collection
Specifies either a URL/name of the Team Project Collection to connect to, or a previously initialized TfsTeamProjectCollection object.
When using a URL, it must be fully qualified. The format of this string is as follows:
http[s]://<ComputerName>:<Port>/[<TFS-vDir>/]<CollectionName>
Valid values for the Transport segment of the URI are HTTP and HTTPS. If you specify a connection URI with a Transport segment, but do not specify a port, the session is created with standards ports: 80 for HTTP and 443 for HTTPS.
To connect to a Team Project Collection by using its name, a TfsConfigurationServer object must be supplied either via -Server argument or via a previous call to the Connect-TfsConfigurationServer cmdlet.
For more details, see the Get-TfsTeamProjectCollection cmdlet.
.EXAMPLE
Get-TfsBuildQueue -BuildDefinition "My Build Definition" -Project "My Team Project"
Get all queued builds given a definition name and a team project name
.EXAMPLE
Get-TfsBuildQueue
Get all queued builds, regardless of definition name or team project name
#>
Function Get-TfsXamlBuildQueue
{
[CmdletBinding()]
[OutputType([Microsoft.TeamFoundation.Build.Client.IQueuedBuild])]
Param
(
[Parameter(Position=0, ValueFromPipeline=$true)]
[ValidateScript({$_ -is [string] -or $_ -is [Microsoft.TeamFoundation.Build.Client.IBuildDefinition]})]
[ValidateNotNullOrEmpty()]
[object]
$BuildDefinition = "*",
[Parameter()]
[object]
$Project,
[Parameter()]
[object]
$Collection
)
Process
{
if ($BuildDefinition -is [Microsoft.TeamFoundation.Build.Client.IBuildDefinition])
{
$buildDefName = $BuildDefinition.Name
}
else
{
$buildDefName = $BuildDefinition
}
if ($Project)
{
$tp = Get-TfsTeamProject $Project $Collection
$tpName = $tp.Name
$tpc = $tp.Store.TeamProjectCollection
}
else
{
$tpName = "*"
$tpc = Get-TfsTeamProjectCollection $Collection
}
$buildServer = $tpc.GetService([type]'Microsoft.TeamFoundation.Build.Client.IBuildServer')
$query = $buildServer.CreateBuildQueueSpec($tpName, $buildDefName)
$buildServer.QueryQueuedBuilds($query).QueuedBuilds
}
}
<#
.SYNOPSIS
Queues a XAML Build.
.PARAMETER BuildDefinition
Build Definition Name that you want to queue.
.PARAMETER Project
Specifies either the name of the Team Project or a previously initialized Microsoft.TeamFoundation.WorkItemTracking.Client.Project object to connect to. If omitted, it defaults to the connection opened by Connect-TfsTeamProject (if any).
For more details, see the Get-TfsTeamProject cmdlet.
.PARAMETER Collection
Specifies either a URL/name of the Team Project Collection to connect to, or a previously initialized TfsTeamProjectCollection object.
When using a URL, it must be fully qualified. The format of this string is as follows:
http[s]://<ComputerName>:<Port>/[<TFS-vDir>/]<CollectionName>
Valid values for the Transport segment of the URI are HTTP and HTTPS. If you specify a connection URI with a Transport segment, but do not specify a port, the session is created with standards ports: 80 for HTTP and 443 for HTTPS.
To connect to a Team Project Collection by using its name, a TfsConfigurationServer object must be supplied either via -Server argument or via a previous call to the Connect-TfsConfigurationServer cmdlet.
For more details, see the Get-TfsTeamProjectCollection cmdlet.
.EXAMPLE
Start-TfsBuild -BuildDefinition "My Build Definition" -Project "MyTeamProject"
This example queue a Build Definition "My Build Definition" of Team Project "MyTeamProject".
#>
Function Start-TfsXamlBuild
{
Param
(
[Parameter(Mandatory=$true, Position=0)]
[object]
$BuildDefinition,
[Parameter(ValueFromPipeline=$true, Mandatory=$true)]
[object]
[ValidateNotNull()]
[ValidateScript({($_ -is [string]) -or ($_ -is [Microsoft.TeamFoundation.WorkItemTracking.Client.Project])})]
$Project,
[Parameter()]
[object]
$Collection,
[Parameter()]
[string]
[ValidateSet("LatestOnQueue", "LatestOnBuild", "Custom")]
$GetOption = "LatestOnBuild",
[Parameter()]
[string]
$GetVersion,
[Parameter()]
[string]
$DropLocation,
[Parameter()]
[hashtable]
$Parameters
)
Process
{
$tp = Get-TfsTeamProject $Project $Collection
$tpc = $tp.Store.TeamProjectCollection
$buildServer = $tpc.GetService([type]"Microsoft.TeamFoundation.Build.Client.IBuildServer")
if ($BuildDefinition -is [Microsoft.TeamFoundation.Build.Client.IBuildDefinition])
{
$buildDef = $BuildDefinition
}
else
{
$buildDef = $buildServer.GetBuildDefinition($tp.Name, $BuildDefinition);
}
$req = $buildDef.CreateBuildRequest()
$req.GetOption = [Microsoft.TeamFoundation.Build.Client.GetOption] $GetOption;
if ($GetOption -eq "Custom")
{
$req.CustomGetVersion = $GetVersion
}
if ($DropLocation)
{
$req.DropLocation = $DropLocation
}
$buildServer.QueueBuild($req)
}
}
Log in or click on link to see number of positives.
- System.Net.Http.Extensions.dll (7b3257f0ea26) - ## / 64
- System.Net.Http.Primitives.dll (c860b2dca751) - ## / 67
- System.Net.Http.Formatting.dll (76ea4b2d47bb) - ## / 67
- TfsCmdlets.1.0.0-alpha7.nupkg (3ac4ebd10cc2) - ## / 57
- Microsoft.IdentityModel.Clients.ActiveDirectory.dll (167ab5abd0c3) - ## / 56
- Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll (f0d79143acbe) - ## / 56
- Microsoft.TeamFoundation.Build.Client.dll (3f5c72c8ddac) - ## / 54
- Microsoft.TeamFoundation.Build.Common.dll (350fbde0aa04) - ## / 54
- Microsoft.TeamFoundation.Build2.WebApi.dll (6e9e17268d08) - ## / 54
- Microsoft.TeamFoundation.Chat.WebApi.dll (a596210d5315) - ## / 53
- Microsoft.TeamFoundation.Client.dll (7410cd472493) - ## / 53
- Microsoft.TeamFoundation.Common.dll (04f724336c71) - ## / 53
- Microsoft.TeamFoundation.Core.WebApi.dll (eb16ff53cbca) - ## / 54
- Microsoft.TeamFoundation.DeleteTeamProject.dll (8a358e0ac50d) - ## / 53
- Microsoft.TeamFoundation.Diff.dll (b6974cc4e333) - ## / 53
- Microsoft.TeamFoundation.Discussion.Client.dll (279228838644) - ## / 53
- Microsoft.TeamFoundation.Discussion.WebApi.dll (5af88699641f) - ## / 53
- Microsoft.TeamFoundation.Git.Client.dll (8c250aaf29fe) - ## / 54
- Microsoft.TeamFoundation.Lab.Client.dll (7bb526562afa) - ## / 53
- Microsoft.TeamFoundation.Lab.Common.dll (8895c5b34054) - ## / 56
- Microsoft.TeamFoundation.Lab.TestIntegration.Client.dll (1e205bc119d1) - ## / 50
- Microsoft.TeamFoundation.Lab.WorkflowIntegration.Client.dll (2f83b8ede5a4) - ## / 54
- Microsoft.TeamFoundation.Policy.WebApi.dll (f689b43be282) - ## / 54
- Microsoft.TeamFoundation.ProjectManagement.dll (2cc74dd61e02) - ## / 54
- Microsoft.TeamFoundation.SharePointReporting.Integration.dll (93de4a069cc5) - ## / 54
- Microsoft.TeamFoundation.SourceControl.WebApi.dll (d091c66cdf42) - ## / 53
- Microsoft.TeamFoundation.Test.WebApi.dll (477ac60465de) - ## / 53
- Microsoft.TeamFoundation.TestImpact.Client.dll (8555f845c780) - ## / 53
- Microsoft.TeamFoundation.TestManagement.Client.dll (d93f1a1caeb9) - ## / 52
- Microsoft.TeamFoundation.TestManagement.Common.dll (7bfe174b2c73) - ## / 52
- Microsoft.TeamFoundation.TestManagement.WebApi.dll (cff8bcc110f8) - ## / 53
- Microsoft.TeamFoundation.VersionControl.Client.dll (21c4e01cfcd9) - ## / 54
- Microsoft.TeamFoundation.VersionControl.Common.dll (a0b9d42cb750) - ## / 53
- Microsoft.TeamFoundation.VersionControl.Common.Integration.dll (b7ef4c7c4385) - ## / 55
- Microsoft.TeamFoundation.Work.WebApi.dll (fafbee0c0703) - ## / 54
- Microsoft.TeamFoundation.WorkItemTracking.Client.DataStoreLoader.dll (819073bb7744) - ## / 55
- Microsoft.TeamFoundation.WorkItemTracking.Client.dll (7f1ebb07300b) - ## / 55
- Microsoft.TeamFoundation.WorkItemTracking.Client.QueryLanguage.dll (935829ccdffb) - ## / 55
- Microsoft.TeamFoundation.WorkItemTracking.Common.dll (4f0562ffc8a4) - ## / 55
- Microsoft.TeamFoundation.WorkItemTracking.Proxy.dll (fbaf7e94a3c5) - ## / 54
- Microsoft.TeamFoundation.WorkItemTracking.WebApi.dll (314c2973ce55) - ## / 54
- Microsoft.VisualStudio.Services.Client.dll (8a2a59395ea5) - ## / 55
- Microsoft.VisualStudio.Services.Common.dll (abf9224d52b2) - ## / 55
- Microsoft.VisualStudio.Services.WebApi.dll (2d05eb7cd25c) - ## / 55
- Microsoft.WITDataStore32.dll (ff1174968798) - ## / 54
- Microsoft.WITDataStore64.dll (d3b6a414174a) - ## / 57
- Newtonsoft.Json.dll (492f637081a4) - ## / 57
- System.IdentityModel.Tokens.Jwt.dll (9b51335056d2) - ## / 56
- System.Web.Http.dll (1666e476e653) - ## / 61
In cases where actual malware is found, the packages are subject to removal. Software sometimes has false positives. Moderators do not necessarily validate the safety of the underlying software, only that a package retrieves software from the official distribution point and/or validate embedded software against official distribution point (where distribution rights allow redistribution).
Chocolatey Pro provides runtime protection from possible malware.
Add to Builder | Version | Downloads | Last Updated | Status |
---|---|---|---|---|
TfsCmdlets 2.9.0 | 51 | Thursday, August 15, 2024 | Approved | |
TfsCmdlets 2.8.2 | 36 | Wednesday, July 24, 2024 | Approved | |
TfsCmdlets 2.8.1 | 26 | Tuesday, July 16, 2024 | Approved | |
TfsCmdlets 2.8.0 | 33 | Tuesday, July 9, 2024 | Approved | |
TfsCmdlets 2.7.1 | 26 | Wednesday, July 3, 2024 | Approved | |
TfsCmdlets 2.6.1 | 46 | Wednesday, May 15, 2024 | Approved | |
TfsCmdlets 2.6.0 | 248 | Saturday, October 1, 2022 | Approved | |
TfsCmdlets 2.5.1 | 62 | Monday, August 22, 2022 | Approved | |
TfsCmdlets 2.5.0 | 60 | Wednesday, August 3, 2022 | Approved | |
TfsCmdlets 2.4.1 | 71 | Thursday, July 21, 2022 | Approved | |
TfsCmdlets 2.4.0 | 93 | Monday, May 23, 2022 | Approved | |
TfsCmdlets 2.3.2 | 63 | Wednesday, May 18, 2022 | Approved | |
TfsCmdlets 2.3.1 | 74 | Saturday, April 9, 2022 | Approved | |
TfsCmdlets 2.3.0 | 71 | Sunday, April 3, 2022 | Approved | |
TfsCmdlets 2.2.1 | 76 | Friday, February 11, 2022 | Approved | |
TfsCmdlets 2.2.0 | 66 | Saturday, February 5, 2022 | Approved | |
TfsCmdlets 2.1.4 | 94 | Tuesday, November 30, 2021 | Approved | |
TfsCmdlets 2.1.3 | 71 | Thursday, November 25, 2021 | Approved | |
TfsCmdlets 2.1.2 | 87 | Friday, September 10, 2021 | Approved | |
TfsCmdlets 2.1.1 | 80 | Wednesday, September 8, 2021 | Approved | |
TfsCmdlets 2.0.0 | 87 | Tuesday, August 3, 2021 | Approved | |
TfsCmdlets 2.0.0-rc0005 | 88 | Sunday, April 18, 2021 | Exempted | |
TfsCmdlets 2.0.0-rc0004 | 88 | Monday, April 5, 2021 | Exempted | |
TfsCmdlets 2.0.0-rc0003 | 78 | Friday, February 19, 2021 | Exempted | |
TfsCmdlets 2.0.0-rc0002 | 87 | Tuesday, December 1, 2020 | Exempted | |
TfsCmdlets 2.0.0-beta0015 | 89 | Tuesday, July 21, 2020 | Exempted | |
TfsCmdlets 2.0.0-beta0014 | 69 | Sunday, July 19, 2020 | Exempted | |
TfsCmdlets 2.0.0-beta0013 | 68 | Saturday, July 18, 2020 | Exempted | |
TfsCmdlets 2.0.0-beta0010 | 162 | Thursday, September 12, 2019 | Exempted | |
TfsCmdlets 2.0.0-beta0009 | 97 | Tuesday, September 10, 2019 | Exempted | |
TfsCmdlets 2.0.0-beta0008 | 109 | Friday, September 6, 2019 | Exempted | |
TfsCmdlets 2.0.0-beta0004 | 119 | Thursday, August 29, 2019 | Exempted | |
TfsCmdlets 1.0.0.894-beta1 | 392 | Thursday, April 6, 2017 | Exempted | |
TfsCmdlets 1.0.0-alpha9 | 333 | Saturday, December 24, 2016 | Exempted | |
TfsCmdlets 1.0.0-alpha7 | 299 | Thursday, October 22, 2015 | Exempted | |
TfsCmdlets 1.0.0-alpha6 | 281 | Thursday, October 22, 2015 | Exempted | |
TfsCmdlets 1.0.0-alpha5 | 259 | Thursday, September 10, 2015 | Exempted | |
TfsCmdlets 1.0.0-alpha4 | 248 | Friday, September 4, 2015 | Exempted | |
TfsCmdlets 1.0.0-alpha3 | 314 | Thursday, September 3, 2015 | Exempted | |
TfsCmdlets 1.0.0-alpha1 | 313 | Friday, July 31, 2015 | Exempted |
(c) 2014 Igor Abade V. Leite. All rights reserved.
This package has no dependencies.
Ground Rules:
- This discussion is only about TfsCmdlets and the TfsCmdlets package. If you have feedback for Chocolatey, please contact the Google Group.
- This discussion will carry over multiple versions. If you have a comment about a particular version, please note that in your comments.
- The maintainers of this Chocolatey Package will be notified about new comments that are posted to this Disqus thread, however, it is NOT a guarantee that you will get a response. If you do not hear back from the maintainers after posting a message below, please follow up by using the link on the left side of this page or follow this link to contact maintainers. If you still hear nothing back, please follow the package triage process.
- Tell us what you love about the package or TfsCmdlets, or tell us what needs improvement.
- Share your experiences with the package, or extra configuration or gotchas that you've found.
- If you use a url, the comment will be flagged for moderation until you've been whitelisted. Disqus moderated comments are approved on a weekly schedule if not sooner. It could take between 1-5 days for your comment to show up.