Created
August 11, 2016 14:17
-
-
Save bmcguirk/0b2de6f03d7804c264317edf49c79d47 to your computer and use it in GitHub Desktop.
Revisions
-
Brian J. McGuirk created this gist
Aug 11, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,9 @@ # Because they pop up like crazy and are often not well-maintained, which is just kind of asking for something awful to happen. # I didn't write this script, but you can see the original blog post here: # http://www.wildwires.com/blog/12-02-24/finding_every_server_that_has_sharepoint_installed.aspx $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"}