Monday, January 17, 2011

TSF + PowerShell: List all projects

This will create TFS instance and get all project from the instance.
$registryValue is an object to be displayed in the output grid of PowerGUI window.

    $tfs = get-tfs "http://TFS-URL"
    $projects = $tfs.CSS.ListAllProjects()
    
    foreach($pro in $projects) {
    $registryValue = New-Object System.Management.Automation.PSObject
    $registryValue `
        | Add-Member -Name Name -MemberType NoteProperty -Value $pro.Name -PassThru `
        | Add-Member -Name Status -MemberType NoteProperty -Value $pro.Status -PassThru `
        | Add-Member -Name URI -MemberType NoteProperty -Value $pro.Uri-PassThru `
        | Add-Member -Name BS -MemberType NoteProperty -Value $tfs.BS -PassThru

0 коммент.:

Post a Comment

Powered by Blogger.