Link to home
Start Free TrialLog in
Avatar of total123
total123Flag for United Kingdom of Great Britain and Northern Ireland

asked on

getting status of windows updates onto a readable document

client would like to know what updaes are installed on a windows 2008 server and would like to run there own report every 3 months.
Easy I thought, this command works treat, but does not display status, e.g. successful or failed. Anybody know the command for getting status as well ?


run from command prompt on windows 2008

wmic qfe list brief /format:texttablewsys > "%USERPROFILE%\hotfix.txt"
Avatar of Alex
Alex
Flag of United Kingdom of Great Britain and Northern Ireland image

https://gallery.technet.microsoft.com/scriptcenter/Get-WindowsUpdate-Retrieve-e53aea50


Full code is there, or just run

 get-windowsupdate | Export-csv c:\temp\WU.csv

Open in new window


Reagrds
Avatar of total123

ASKER

thanks, when i run get-windowsupdate, even with all the text, i get

The term 'get-windowsupdate' is not recognized as the name of a cmdlet, function, script file, or operable program. Che
ck the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:18
+ get-windowsupdate <<<<
    + CategoryInfo          : ObjectNotFound: (get-windowsupdate:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
Is it windows server 2008 or 2008R2?

If it's 2008

Function Get-MSHotfix 
{ 
    $outputs = Invoke-Expression "wmic qfe list" 
    $outputs = $outputs[1..($outputs.length)] 
     
     
    foreach ($output in $Outputs) { 
        if ($output) { 
            $output = $output -replace 'Security Update','Security-Update' 
            $output = $output -replace 'NT AUTHORITY','NT-AUTHORITY' 
            $output = $output -replace '\s+',' ' 
            $parts = $output -split ' '
            if ($parts[5] -like "*/*/*") { 
                $Dateis = [datetime]::ParseExact($parts[5], '%M/%d/yyyy',[Globalization.cultureinfo]::GetCultureInfo("en-US").DateTimeFormat) 
            } else { 
                $Dateis = get-date([DateTime][Convert]::ToInt64("$parts[5]", 16)) -Format '%M/%d/yyyy' 
            } 
            New-Object -Type PSObject -Property @{ 
                KBArticle = [string]$parts[0] 
                Computername = [string]$parts[1] 
                Description = [string]$parts[2] 
                FixComments = [string]$parts[6] 
                HotFixID = [string]$parts[3] 
                InstalledOn = Get-Date($Dateis)-format "dddd d MMMM yyyy" 
                InstalledBy = [string]$parts[4] 
                InstallDate = [string]$parts[7] 
                Name = [string]$parts[8] 
                ServicePackInEffect = [string]$parts[9] 
                Status = [string]$parts[10] 
            } 
        } 
    } 
} 

Open in new window

its 2008 r2
If it helps I just sourced this for you, 2008 r2 is supported for this script
Generate a Report for installed Hotfix-Update-ServicePack for Bulk Servers
[Version 3-04.08.14] Run that Script.
You will get a report(txt) for installed Hotfix for bulk Computers and get an additional txt output for unreachable computers.
Getting the Full Scripts you have to download the ZIP file.
https://gallery.technet.microsoft.com/scriptcenter/Generate-a-Report-for-f71a6800
thanks merete

I did see this a few days ago and ran it. I've gone through the powershell and cannot see where it outputs to. I'm not a powershell expert. Any advice on what to do to get it to output to a file name / location ?
ASKER CERTIFIED SOLUTION
Avatar of Merete
Merete
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thanks for your help