Monday, April 29, 2013

Retrospectively timing long-running operations in PowerShell

Sometimes I run an operation that takes longer than I expect to execute, but once it is finished, the only way to see how long it did take is to run it again in Measure-Command or use some other timing mechanism. This PowerShell prompt preserves your existing prompt (for example PoshGit) and tacks on an execution time for each and every command you run.
C:\Demo [master]> Start-Sleep 3
00:00:03.0048920
C:\Demo [master]> Start-Sleep 5
00:00:04.9974939
C:\Demo [master]>
00:00:00.0004274
C:\Demo [master]>

Thursday, April 25, 2013

Old SysInternals source code

The source code for SysInternals tools is no longer published, although it was for some of the tools before Microsoft purchased them.

The source code can be downloaded for those tools at the Internet Archive.

Monday, April 22, 2013

Launch NUnit GUI with multiple assemblies

The NUnit GUI does not support loading multiple assemblies from the command line, so this PowerShell function creates an NUnit project file that can be specified as a command line argument. Just provide a file name for the new project file (must end in .nunit or NUnit will barf) and an array of assembly files to load.

As a bonus, this project file will load your assemblies in multiple process mode, which means that any associated assembly configuration files will be correctly loaded.