windows - Script Powershell to list installed updates -
i'm new here, looking script me list windows updates , put them on excel, have lot of code works set apart display of dates, can help? here code:
$system=get-wmiobject -class win32_operatingsystem -computer . $system=$system.csname $excel = new-object -com excel.application $excel.visible = $true $excel = $excel.workbooks.add() $updatesearcher = new-object -com "microsoft.update.searcher" $totalupdates = $updatesearcher.gettotalhistorycount() $patchlist=$updatesearcher.queryhistory(0,$totalupdates) write-host "nombre total de patches installés sur le poste [$system] :" $patchlist.count write-host "préparation du classeur excel...." $sheet = $excel.worksheets.item(1) $sheet.name = "patches installés" $sheet.cells.item(1,1) = "titre" $sheet.cells.item(1,2) = "description" $sheet.cells.item(1,3) = "date" $sheet.activate() $sheet.application.activewindow.splitrow = 1 $sheet.application.activewindow.freezepanes = $true $introw = 2 $workbook = $sheet.usedrange $workbook.interior.colorindex = 11 $workbook.font.colorindex = 19 $workbook.font.bold = $true foreach($patch in $patchlist){ $hotfixid=$patch.title $hotfixid=$hotfixid.split('(') $hotfixid=$hotfixid[1] $hotfixid=$hotfixid.trim(')') $sheet.cells.item($introw, 1) = $hotfixid $sheet.cells.item($introw, 2) = $patch.title $sheet.cells.item($introw, 3) = $patch.installeddate $introw = $introw + 1}
you can information $patch.date
within foreach loop
Comments
Post a Comment