1
Vote

PowerShell script error / install

description

Is the PowerShell script required (not mentioned on blog post page nor included with zip download of binary)? When I try to run it in PowerShell IDE (x64) on win server 2012 R2 it errors out - doesn't like line 4 and 5.

PS C:\Users\geoff.hudik> Reflection.Assembly::Load("Microsoft.TeamFoundation.Client, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a");
$collectionBaseUrl = "http://localhost:8080/tfs/DefaultCollection/"; $tfs = Microsoft.TeamFoundation.Client.TeamFoundationServerFactory::GetServer($collectionBaseUrl);
$collectionHive = $tfs.GetService(Microsoft.TeamFoundation.Framework.Client.ITeamFoundationRegistry);
$collectionHive.SetValue("/Inmeta/MergeEventHandler/Enabled", True);
At line:4 char:35
  • $collectionHive = $tfs.GetService(Microsoft.TeamFoundation.Framework.Client.ITea ...
  • ~
    Missing ')' in method call.
    At line:4 char:35
  • $collectionHive = $tfs.GetService(Microsoft.TeamFoundation.Framework.Client.ITea ...
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Unexpected token 'Microsoft.TeamFoundation.Framework.Client.ITeamFoundationRegistry' in expression or statement.
    At line:4 char:100
  • ... ndationRegistry);
  • ~
    Unexpected token ')' in expression or statement.
    At line:5 char:62
  • $collectionHive.SetValue("/Inmeta/MergeEventHandler/Enabled", True);
  • ~
    Missing expression after ','.
    At line:5 char:63
  • $collectionHive.SetValue("/Inmeta/MergeEventHandler/Enabled", True);
  • ~~~~
    Unexpected token 'True' in expression or statement.
    At line:5 char:67
  • $collectionHive.SetValue("/Inmeta/MergeEventHandler/Enabled", True);
  • ~
    Unexpected token ')' in expression or statement.
    • CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
    • FullyQualifiedErrorId : MissingEndParenthesisInMethodCall
PS C:\Users\geoff.hudik>

comments

thnk2wn wrote Oct 7, 2015 at 12:13 AM

There were multiple syntax errors with the script provided. Correct script provided below.
[System.Reflection.Assembly]::Load("Microsoft.TeamFoundation.Client, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a");
$collectionBaseUrl = "http://localhost:8080/tfs/Main/";
$tfs = [Microsoft.TeamFoundation.Client.TeamFoundationServerFactory]::GetServer($collectionBaseUrl); 
$collectionHive = $tfs.GetService([Microsoft.TeamFoundation.Framework.Client.ITeamFoundationRegistry]);
$collectionHive.SetValue("/Inmeta/MergeEventHandler/Enabled", $true);