Skip to content

Instantly share code, notes, and snippets.

@brunomlopes
Created May 4, 2010 13:02
Show Gist options
  • Save brunomlopes/389381 to your computer and use it in GitHub Desktop.
Save brunomlopes/389381 to your computer and use it in GitHub Desktop.
Simple script to update installed nhprof to latest downloaded version
if (Test-Path "env:ProgramFiles(x86)"){
$outputdirectoryArg ="-oC:\Program Files (x86)\Nhibernate.Profiler"
}else{
$outputdirectoryArg ="-oC:\Program Files\Nhibernate.Profiler"
}
if (@(get-process | where {$_.ProcessName -eq "nhprof"}).Count -gt 0){
[System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
[System.Windows.Forms.MessageBox]::Show("Please stop nhprof before updating it")
}else{
$zip = "C:\Program Files\7-Zip\7z.exe"
$latestNHibernate = @(Get-ChildItem e:\downloads\NHibernate* | sort-object -Property CreationTime -Descending )[0]
&$zip x $latestNHibernate $outputdirectoryArg -Y
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment