Skip to content

Instantly share code, notes, and snippets.

@joerodgers
Created December 3, 2019 18:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joerodgers/4c89817d38833bb0a9977aaa82ec70c7 to your computer and use it in GitHub Desktop.
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'
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