James O'Neill's Blog

September 8, 2008

Net maps – PowerShell and Excel

Filed under: Office,Powershell — jamesone111 @ 2:46 pm

Over the weekend I picked up a link from Jeffrey, which took me to this post by Doug. My post from Friday had already got me thinking about visualization stuff and so I went off on the link that Doug provided. A nice little snippet of PowerShell which piqued my interest and a link to another post of his which explains Microsoft Research released .NetMap – linking to the download on codeplex. “I’ve got to try this” I thought. So after a couple of hiccups with the installation I had it installed and was playing with the Excel test harness they built for it. To get an idea of what it can do it imports information about mails you’ve had with who links to who, and I had fun hour playing with that last night, Here’s the result. I’ve blurred the names except my own, but the items in centre are distribution lists I belong to. The huge star burst on the bottom left is one of the main activists on the Virtualization discussion lists: I’ll dream up some other uses for this in due course, but I’d love to see what other people come up with

Update I wrote a little bit of PowerShell to map out links between WMI objects

Function get-related
 {param($class, $maxlevels)
  if ($global:done -notContains $class) {$global:done +=  $class
      $classes=(([wmiclass]”\\.\root\cimv2:$class”).getRelatedClasses() | where {$_.name -like “Win32*”})
   $classes | select-object -property @{Name=”Source”; expression={$class}}, @{Name=”Target”;expression={$_.name}}
   if ($maxLevels -gt 0)   {$classes | foreach-object {get-related $_.name ($maxLevels -1 )}  }

PS > [string[]]$done=@()
PS > get-related “Win32_ComputerSystem” 2 | show-netmap

The result is attached below … the picture

Click for full size view

This post originally appeared on my technet blog.


Create a free website or blog at WordPress.com.

%d bloggers like this: