PowerShell Tip: Get-HotFix not working
Summary
This TechNet wiki is based on the experience in my Client Environment. We use to execute a Hot Fix report after Patch Update. It's good to do this using scripts rather than manual intervention. Indeed, I was doing it using PowerShell.
Scenario
We have a SharePoint 2010 Farm running on Windows 2008 R2 Standard. 3 Servers in the farm as we all know One Web Front End One Application One SQL After the patch update My WFE and SQL responded for Get-HotFix Command but application server returned blank
Help
help Get-HotFix -Detailed help Get-HotFix -Examples help Get-HotFix -Full |
PowerShell Code
# ----------------------------------------------------------------------------- # Script : SharePoint Farm Daily Reports # Author : Chendrayan Venkatesan # Puspose : To get Hot Fix inventory report for auditing # ----------------------------------------------------------------------------- #Get All the Servers $Servers = @("server1" , "server2") #Get the hot-fix in a variable for desired output $HotFixDetails = Get-HotFix -ComputerName $servers | Select CSName , HotFixID , InstalledOn , InstalledBy , Caption , Description | ConvertTo-Html -Fragment ConvertTo-Html -Body "$HotFixDetails" -CssUri C:\style.CSS | Out-File "Location to Save" #Send Mail $SMTP = "Your SMTP Server Name" $From = "From Adddress" $To = "To Adddress" Send-MailMessage -SmtpServer $SMTP -From $From -To $To -Subject "SharePoint Hot Fix Installation Report" -Attachments "Location of the file" |
Download Code
Root Cause
Why one of the Windows 2008 R2 not responded to Get-HotFix? My CSV file has gave output like 'SPAPP-?!' Nothing I could have think of when I saw exception pop up in my server
Solution
System Update Readiness Tool for Windows 7 for x64-based Systems (KB947821) [May 2014]
Download and Fix the exception. Later executed the above script. Bingo!!! Turned Green.
Enjoy PowerShell :)