Finding Every Server That Has SharePoint Installed

For whatever reason SharePoint teams sites tend to popup all over the network.  Somehow marketing gets a server. Marketing then installs SharePoint on it themselves.  Marketing becomes dependent on the data SharePoint houses.  This usually underpowered and fault intolerant server crashes and burns.  The data is lost.  Orgnaization suffers.

This is just one senerio, but there are many reasons why you don’t want SharePoint weeds in your network.  Licensing.  The “What did you know and when did you know it factor” to name a few.  @buckleyPlanet posted a microblog on twitter.

“Are there any community/3rd party replacements for the #SharePoint Asset Inventory Tool?” was the entire post that started me thinking about all that.  At the time I had totally forgotten about this tool.  Apparently it’s gone.  I don’t know why, but the links I got to give me a 403.  It could be misplaced or removed without notice.  So I got to thinking about replacements for this thing.

All it did was tell you what servers were running SharePoint and how many sites and site collections there were on each server that it found.  At least that’s what I think it did. Anyways my mind flooded with alternatives and started searching the web for more.  THere are a few ways to do this, the one I actually tried out was using PowerShell.  It took me about an hour to write:

 

$objSearcher = New-Object System.DirectoryServices.DirectorySearcher
$objSearcher.Filter = '(OperatingSystem=Window*Server*)'
"Name","canonicalname","distinguishedname" | Foreach-Object {$null = $objSearcher.PropertiesToLoad.Add($_) }
$names = $objSearcher.FindAll() | Select-Object @{n='Name';e={$_.properties['name']}},@{n='ParentOU';e={$_.properties['distinguishedname'] -replace '^[^,]+,'}},@{n='CanonicalName';e={$_.properties['canonicalname']}},@{n='DN';e={$_.properties['distinguishedname']}}
$names | forEach-object{$_.name + "`n" + "=================="; get-wmiobject -computerName $_.name -class win32_product | where {$_.Name -eq "Microsoft SharePoint Server 2010 "}; "`n"; "`n"}

I say I wrote it.  I copy and pasted my way to it.  the first part I ripped off from http://social.technet.microsoft.com/Forums/eu/ITCG/thread/9d501454-2f51-43b5-8bea-303a1c9f2094 The second part I had from something I was doing earlier in the week.

This script isn’t awesome it just is.

  • Facebook
  • DZone It!
  • Digg It!
  • StumbleUpon
  • Technorati
  • Del.icio.us
  • NewsVine
  • Reddit
  • Blinklist
  • Furl it!

Comments (2)

  • Christian Buckley 2/24/2012 12:00:00 AM

    Thanks Stacy for being incredibly bored last night and taking the time to go into such great detail. I am going to write a slightly longer post and point people to you and your solution, as this is one of those little useful things that people ask for quite often.
  • @SPJeff 2/24/2012 12:00:00 AM

    Cool stuff, WMI is very handy.

    I think there is also a way to block the install of SharePoint 2010 setup binaries with Active Directory GPO.   Could help mitigate future server sprawl.http://blog.bugrapostaci.com/2011/04/15/how-to-prevent-install-sharepoint-using-group-policy/

Post a comment!
  1. Formatting options
       
     
     
     
     
       



Rss Feed
    follow me on Twitter

    Where I'm Going

    Some Writing I've Done


    Chat With Me