Created
December 3, 2019 18:49
-
-
Save joerodgers/4c89817d38833bb0a9977aaa82ec70c7 to your computer and use it in GitHub Desktop.
Queries all the servers in the farm and reports the name, version and installation date for 'Microsoft SQL Server 201x RS Addin for SharePoint'
This file contains 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 characters
Add-PSSnapin -Name Microsoft.SharePoint.PowerShell | |
$servers = @(Get-SPServer | ? Role -ne "Invalid" | SELECT -ExpandProperty Name) | |
foreach( $server in $servers ) | |
{ | |
$products = @(Get-CimInstance -ClassName Win32_Product -ComputerName $server -Filter "Name like 'Microsoft SQL Server%RS Addin%'") | |
if( $products.Count -gt 0 ) | |
{ | |
$products | SELECT PSComputerName, Name, Version, @{N="InstallDate";e={[DateTime]::ParseExact($_.InstallDate, "yyyyMMdd", [System.Globalization.CultureInfo]::InvariantCulture).ToString("MM/dd/yyyy")}} | |
} | |
else | |
{ | |
[PSCustomObject] @{ | |
PSComputerName = $server | |
Name = "NOT FOUND" | |
Version = "N/A" | |
InstallDate = "N/A" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment