none
Systeminfo hotfix info RRS feed

  • Question

  • I running into a problem trying to get useful information about my computers.

    I need to be able to use a txt file called computers.txt which has all my computers that I handle.

    I need to be able to make sure it is on the network.

    Then I need to check if there are any missing KB hotfixs from a master listing in a text file called master.txt which only has the KB listed.

    If the target computer does not have a certain hotfix installed it would port out to a running result.txt file.

    Need the format to be something like:

    computername, KB111111

    Computername, KB222222

    once the task has been completed I can open with excel and do a pivot report to identify the patches that are not installed.

    What I do right now is I do a very quick check on a computer using the following command: systeminfo | find "Hotfix(s)" so that I have a starting point. If the value is not equal to the magic number then I know I have a problem. Doing this on 500 plus machine is a bit of a pain.

    If anyone has a VB or batch file that would do this please post.

    Right now doing it the hard way due to the network restrictions.

    Thursday, March 6, 2014 7:51 PM

Answers

All replies

  • Hi,

    Usually we manage patches from a server-based solution such as WSUS.

    Bill


    -- Bill Stewart [Bill_Stewart]

    Thursday, March 6, 2014 7:57 PM
    Moderator
  • It is not likely you will find the exact code.  You might want to start writing it yourself and post back with questions.

    I recommend uing only PowerShell as it has most of that built in already.

    See the  "Get-Hotfix" CmdLet.


    ¯\_(ツ)_/¯

    Thursday, March 6, 2014 11:54 PM
  • Hello,

    I agree with JRV that you really should use PowerShell for this.  I threw some code together that should get you started. 

    You would put your computers.txt, master.txt, and this script (I called it Check-Hotfix.ps1) all in the same directory and then call it like this:

    Open a PS command shell, make sure the account you are running as has access to the servers in your list.

    Then you would type:

    PS C:\> cd <path to your script directory>

    PS C:\Scripts> get-content '.\computers.txt' | .\Check-Hotfix.ps1

    The script is:

    [CmdletBinding()]
    param
    ( 
        [Parameter(Mandatory=$true,
             ValueFromPipeline=$true,
             Position=0)]
        [string[]]$ComputerList
    )
    Begin
    { 
    }
    
    Process
    {
        $MasterKBList = get-content -Path '.\master.txt'
        foreach ($ComputerName in $ComputerList)
        { 
            if (Test-Connection -ComputerName $ComputerName)
            { 
                $HotFixList = Get-Hotfix -ComputerName $ComputerName | Select-Object -Property HotFixID
                $MasterKBList | % {
                    $CurrKB = $_
                    If(($HotFixList | ? {$_.HotFixID -eq $CurrKB}) -eq $null) { "$ComputerName,$_" | out-file -Append -FilePath '.\result.txt'}
                }
            }    
        }
    }

    Happy coding.

    I wrote this to do exactly what you asked but I must admit that this would be a really crappy way of managing this process.  You really should look at WSUS or SCCM or even Shavlik for a more robust and scalable solution.




    Friday, March 7, 2014 1:26 AM