<

Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x

Powershell: Export Hotfix details of Remote Computers

Published on
3,816 Points
616 Views
2 Endorsements
Last Modified:
Jinish KG
I'm Jinish KG,  Total 10 years of experience in IT field.
A procedure for exporting installed hotfix details of remote computers using powershell

Method Used


PowerShell Scripting



Tested Versions


PowerShell v2, v3, v4 and v5



Operating systems used


 Windows 10, Windows server 2012, Windows server 2016 technical Preview 4



Procedure


There are several commands to get installed hotfix details of a local computer.

To get those details open the PowerShell console and execute the command

Get-hotfix


For example


1.jpg



The output will display the source computername, type of patch whether it is Update or security patch, Hotfix ID, Date and time of installation. We can use the pipe to filter the current output as per our requirement.

The same one liner command can be used for checking hotfix details of remote computers. For that we need to use -computername switch with get-hotfix command. After -computername we need to specify the remote computername. The command will be look like as shown below


Get-hotfix -computername <host name of Remote Computer>


For Example


 

2.jpg
The above one liner command will be useful for export patch installation details of one or two hosts. But if we need to export hotfix installation of multiple remote computers, it will be time consuming.

Here we are explaining a small script which is used to export details of updated patches of multiple remote computers without any head ache

 Download script


 https://gallery.technet.microsoft.com/How-to-Export-Hotfix-e61e9782 [embed=image 1130975]



We used same one-line command here but instead of computer name used a variable called $server.

That means the command will take the computername as a variable. For that we need to provide a list of computers list named computers.txtThe computers.txt  file contains all servers details one by one. You can use both hostnames and IP address.

For demo purpose I have used 3 hostnames as shown in below example


Example




 3.jpg

How to run the script


  • Copy the exporthotfix.ps1 and computers.txt file in a single folder.
  • Open the PowerShell as an administrator and disable the script execution restriction by entering the below command
Set-executionpolicy unrestricted

Open in new window

 4.jpgPress Y to confirm.
  • Right click the script and select Run with PowerShell.
  • Output will be saved in C:\windows\temp. You can modify the output path by modifying the script.

 5.jpg
6.jpg
7.jpg
Here we used to export the contents as a CSV format. If you need to export the output as a TXT format modify the below line in script and save

$QFE = Get-hotfix -computername $server | select-object -property Description,HotFixID,InstalledBy,InstalledOn | out-file c:\windows\temp\$server.txt

Open in new window


 This time the output will save as a txt format
 8.jpg9.jpg
2
Comment
Author:Jinish KG
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 8

Expert Comment

by:Senior IT System Engineer
Thanks for sharing !
0

Featured Post

Q2 2017 - Latest Malware & Internet Attacks

WatchGuard’s Threat Lab is a group of dedicated threat researchers committed to helping you stay ahead of the bad guys by providing in-depth analysis of the top security threats to your network.  Check out our latest Quarterly Internet Security Report!

Join & Write a Comment

This tutorial will give a short introduction and overview of Backup Exec 2012 and how to navigate and perform basic functions. Click on the Backup Exec button in the upper left corner. From here, are global settings for the application such as conne…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

Keep in touch with Experts Exchange

Tech news and trends delivered to your inbox every month