PowerShell script to find the hotfix installed and its details on the server:

The report will have the below contents:

1. Current SharePoint build versions.
2. Hot Fix ID.
3. Who installed the hot fix?
4. When was the hot fix installed?

Edit the script to pass on the server names, from, to and SMTP address to send an email on the hotfix report. Download the attached file to get the .css file for the report.
  1. $LogTime = Get-Date -Format yyyy-MM-dd_hh-mm
  2. $LogFile = ".\HotFixReportPatch-$LogTime.rtf"
  3. # Add SharePoint PowerShell Snapin
  4. if ( (Get-PSSnapin -Name Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue) -eq $null ) {
  5. Add-PSSnapin Microsoft.SharePoint.Powershell
  6. }
  7. $scriptBase = split-path $SCRIPT:MyInvocation.MyCommand.Path -parent
  8. Set-Location $scriptBase
  9. #Deleting any .rtf files in the scriptbase location
  10. $FindRTFFile = Get-ChildItem $scriptBase\*.* -include *.rtf
  11. if($FindRTFFile)
  12. {
  13. foreach($file in $FindRTFFile)
  14. {
  15. remove-item $file
  16. }
  17. }
  18. start-transcript $logfile
  19. #Get All the Servers where you need to find the hot fix report
  20. #$Servers = @("server1" , "server2")
  21. $Servers = @("Server names")
  22. #Get the hot-fix in a variable for desired output
  23. $HotFixDetails = Get-HotFix -ComputerName $servers | Select CSName , HotFixID , InstalledOn , InstalledBy , Caption , Description | ConvertTo-Html -Fragment
  24. ConvertTo-Html -Body "$HotFixDetails" -CssUri $scriptbase\style.CSS | Out-File $scriptbase\HotFix.html
  25. write-host "The output is in the location $scriptbase\HotFix.html" -fore green
  26. #Send Mail
  27. $SMTP = "Your SMTP Server Name"
  28. $From = "From Adddress"
  29. $To = "To Adddress"
  30. Send-MailMessage -SmtpServer $SMTP -From $From -To $To -Subject "SharePoint Hot Fix Installation Report" -Attachments $scriptbase\HotFix.html
  31. write-host "Email with hotfix informations sent to $To" -fore cyan