Keith posted a console app he created to determine the processes that are running .NET applications.
I got thinking that this type of "utility" apps are perfect for PowerShell. So I took Keith's code and made an equivalent powershell script.
$dotnet = @()
$procs = get-process
foreach ($proc in $procs)
{
$mods = $proc.Modules
foreach ($mod in $mods)
{
if ($mod.ModuleName -ieq "mscorwks.dll")
{
$info = new-object -typename System.Object
$info | add-member -membertype noteProperty -name ProcessName -value $proc.ProcessName
[void] $foreach.MoveNext()
$info | add-member -membertype noteProperty -name VersionInfo -value $mod.FileVersionInfo.ProductVersion
$dotnet += $info
}
}
}
$dotnet | format-table * -auto
"Processes found : {0} | Processes running .NET : {1}" -f $procs.Length, $dotnet.Length
And here's a one-liner version for the script.
gps | % { $procname = $_.ProcessName; $_.Modules | % { if($_.ModuleName -ieq "mscorwks.dll
") { "{0} {1}" -f $procname,$_.FileVersionInfo.ProductVersion }}}
...well, a partial one. ;-)
Source: Keith Rull : How To: Check if there are processes that are running using .NET
I was stumped by what seemed like a very simple problem that I was beginning to lose some self-esteem :-( I was sure it was a simple problem but for the life of me, I couldn't make it
work. So what was it? I was trying to publish the .NET implementation of the Petshop 4.0 application to my local IIS using Visual Studio 2005. However, the images won't display when I open the site in localhost. Running the web app using the ASP.NET web development server didn't have the same problem. I spent most of my time fiddling around with http headers, asp.net configuration settings, etc. The one thing I didn't realize until much later, I was publishing the app to IIS 7 (which is not installed by default in Vista). A few minutes of searching gave me the answer. IIS 7 does not serve static content (including images) unless I turn it on. To turn it on in Vista, you go to "Control Panel\Programs\Programs and Features\Turn Windows features on or off" then "Internet information Services\World Wide Web Services\Common Http Features\Static Content." I have to chalk this up to my list of IIS 7 gotcha's.
However, not all that searching was a wasted effort. It managed to turn this up. I haven't really been following the IIS scene so when I saw some of the developments going on, I couldn't help but be excited.
ServerSide : 10 steps to get Ruby on Rails running on Windows with IIS FastCGI
Now this is really exciting. RoR on Windows + IIS. And with John Lam in the CLR team, first class Ruby in .NET won't be far behind. IronPython is already there. With FastCGI, IIS 7 has improved support to serve PHP pages as well. Based on iis.net, "The FastCGI component is part of the collaboration between Microsoft and Zend to improve performance and stability of PHP on the Windows platform."
Something light to end my work week. See comic here