This is a useful article on talking to tfs from powershell.
The main trick is to install the tfs sdk so that you can get the assemblies required to remotely access the build server.
Random outpourings of a software developer
This is a useful article on talking to tfs from powershell.
The main trick is to install the tfs sdk so that you can get the assemblies required to remotely access the build server.
Recent deployments of powershell don’t come with this assembly, which you need to write cmdlets in C#.
You need to install the powershell 2.0 sdk and look for:
$(ProgramFiles)Reference AssembliesMicrosoftWindowsPowerShellv1.0System.Management.Automation.dll
Here is a simple cmdlet:
using System.Management.Automation;
namespace SimpleGreeting
{
[Cmdlet(VerbsCommunications.Send, “Greeting”)]
public class SendGreetingCommand : Cmdlet
{
[Parameter(Mandatory=true)]
public string Name { get; set; }
protected override void ProcessRecord()
{
WriteObject(“Hello” + Name + “!”);
}
}
}
And here is the installer required:
using System.Management.Automation;
using System.ComponentModel;
namespace SimpleGreeting
{
[RunInstaller(true)]
public class RegisterSimpleGreeting : PSSnapIn
{
public override string Description
{
get { return “This is a demo snapin”; }
}
public override string Name
{
get { return “SendGreetingSnapin”; }
}
public override string Vendor
{
get { return “C.J Eyre Harlequin Design”; }
}
}
}
You need to use installutil to register the snapin.
Here is a sample of a grep equivalent in powershell
dir *.rdl | select-string “.Report_”
This is an article on using ado.net from Powershell
The following commands are the best starting point for Powershell:
Get-Help
Get-Command
Format-List
Get-Alias
I have a need to configure Sharepoint in a repeatable manner and have considered Powershell as a possible means of doing so.
Here is a site that provides basic PowerShell documentation
Here is a site that has 5 useful Sharepoint PowerShell functions.
The code is missing a reference to the assembly but that can easily be fixed.
This is a site that proves a sample script to recycle the app pool – something that you need to do very frequently in sharepoint development.