DevOps Monkey Goodness

Monthly archives for August, 2011

How to Register and UnRegister NCover...

How to Register and UnRegister NCover in MSBuild

If you need to register and unregister NCover as part of your build process you can easily use the provided NCover.Registration.exe provided by the NCover installation. Here’s a snippet of a build file: <BuildRoot>$(MSBuildThisFileDirectory)</BuildRoot> <BuildToolsDir>$(BuildRoot)\BuildTools</BuildToolsDir> <BuildSolutionDir>$(BuildRoot)\Src</BuildSolutionDir> <NCoverRootDir>$(BuildToolsdir)\NCover</NCoverRootDir> <NCoverConsoleExe>$(NCoverRootDir)\NCover.Console.exe</NCoverConsoleExe> <NCoverRegistrationExe>$(NCoverRootDir)\NCover.Registration.exe</NCoverRegistrationExe> <NCoverMSBuildTaskAssembly>$(NCoverRootDir)\BuildTaskPlugins\NCover.MSBuildTasks.dll</NCoverMSBuildTaskAssembly> <TestMSTestExe>$(VS100COMNTOOLS)\..\IDE\MSTest.exe</TestMSTestExe <TestResultsDir>$(BuildRoot)TestResults</TestResultsDir> <UsingTask TaskName=”NCover.MSBuildTasks.NCover” AssemblyFile=”$(NCoverMSBuildTaskAssembly)”/> <Target Name=”TestNCoverRegister”> <Exec Command=”&quot;$(NCoverRegistrationExe)&quot; //license [KEY]”/> </Target> <Target Name=”TestNCoverUnRegister”> <Exec […]

How To Install IIS7 Rewrite Module Wi...

How To Install IIS7 Rewrite Module With PowerShell

function Is64Bit { [IntPtr]::Size -eq 8 } function InstallIISRewriteModule(){ $wc = New-Object System.Net.WebClient $dest = “IISRewrite.msi” $url if (Is64Bit){ $url = “http://go.microsoft.com/?linkid=9722532” } else{ $url = “http://go.microsoft.com/?linkid=9722533” } $wc.DownloadFile($url, $dest) msiexec.exe /i IISRewrite.msi /passive } if (!(Test-Path “$env:programfiles\Reference Assemblies\Microsoft\IIS\Microsoft.Web.Iis.Rewrite.dll”)){ InstallIISRewriteModule } else { Write-Host “IIS Rewrite Module – Already Installed…” -ForegroundColor Green }

How To Get TFS 2010 Last Green Build ...

How To Get TFS 2010 Last Green Build With Powershell And MSBuild

Today I needed to use the TFS API to get the last successful green build info from TFS so I thought whilst I’m still learning PowerShell I’ll give it a go in that.  Anyway here’s what I came up with, I could have condensed the lines but whilst I was debugging in PowerShellGUI (which is […]

How To Enable TCP and Named Pipes Wit...

How To Enable TCP and Named Pipes With Powershell

Quick sample on how to use Powershelol to enable SQL Server protocols and restart the default instance service afterwards:   [reflection.assembly]::LoadWithPartialName(“Microsoft.SqlServer.Smo”) [reflection.assembly]::LoadWithPartialName(“Microsoft.SqlServer.SqlWmiManagement”) function EnableSQLProtocols(){ $smo = ‘Microsoft.SqlServer.Management.Smo.’ $wmi = new-object ($smo + ‘Wmi.ManagedComputer’). # List the object properties, including the instance names. $Wmi # Enable the TCP protocol on the default instance. $uri = “ManagedComputer[@Name='” […]

TFS 2010 Missing Labels Retention Pol...

TFS 2010 Missing Labels Retention Policy

I had an interesting one today whilst getting an emergency fix out, well trying to!  Here’s the scenerio: Version 2.0.0.6734 of product X has been deployed with a bug. Oh no we need to get a fix out quickly!  That’s ok though we have a good CI process of labeling the builds upon every build […]

How To Rename an IIS Site Or Web Appl...

How To Rename an IIS Site Or Web Application in Powershell

  Using the Powershell WebAdminsitration module (IIS7 only) it’s very easy to rename web applications that you can’t do through the interface: Import-Module WebAdministration Rename-Item ‘IIS:\Sites\SiteName\WebApplicationName’ ‘NewName’ Or if you want to do it manually just modify the IIS7 metadata: %windir%\System32\inetsrv\config\applicationHost.config (be careful though!)

Install and Configure Sonar on Window...

Install and Configure Sonar on Windows 2008 For .Net Part 2

In part 1 of my installing and configuring series I had a very basic Sonar setup running using just the core C# plugin to produce a basic Sonar report.  In this article I’m going to integrate Gendarme, NCover using Gallio and hook up Sonar to a SQL Server database instead of using the inbuilt Derby DB. CONFIGURE SONAR […]

Word Press 404 The requested document...

Word Press 404 The requested document was not found on this server

I’ve just started to experient with buying domains with good PR and the sites that I’m buying happen to come built with Word Press.  I’ve never used Word Press before but so far I’m really impressed!  Previously I have used BlogEngine.Net which seems quite primitive in comparison with the power of WP.  Although moving WP […]

A Better Powershell Stack Trace

A Better Powershell Stack Trace

Getting a decent stack trace can be tricky at first in PowerShell but here’s a neat function taken from the PSCX cmdlets: function Resolve-Error(){ param( [Parameter(Position=0, ValueFromPipeline=$true)] [ValidateNotNull()] [System.Management.Automation.ErrorRecord[]] $ErrorRecord ) process { if (!$ErrorRecord) { if ($global:Error.Count -eq 0) { Write-Host “The `$Error collection is empty.” return } else { $ErrorRecord = @($global:Error[0]) } } […]

Install and Configure Sonar on Window...

Install and Configure Sonar on Windows 2008 For .Net Part 1

I’m currently looking at integrating Sonar into our build environment which intially didn’t go too well interms of installation so I thought I’d document what I did and what was required for future reference.  In this first part I will show you how to configure Sonar to run with a basic out of the box setup […]