・同じフォルダ内にある更新パッチを全て適用
・適用前、適用後のインストール済みパッチ一覧を比較
・ログをイベントビューア形式で保存
---------------------------------------------------------------
Get-HotFix | format-list > before.txt
if (([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole(`
[Security.Principal.WindowsBuiltInRole] "Administrator")) {
"MSU"
$c = 0;
$a = dir *.msu;
$a | % {
"{0} / {1} {2}" -f (++$c), $a.length, $_.name;
#start C:\Windows\System32\wusa.exe -argumentlist $_.name -wait
start C:\Windows\System32\wusa.exe -argumentlist '/quiet','/norestart','/log:log_msu.evtx',$_.name -wait
$?
}
"EXE"
$c = 0;
$a = dir *.exe;
$a | % {
"{0} / {1} {2}" -f (++$c), $a.length, $_.name;
#start C:\Windows\System32\wusa.exe -argumentlist $_.name -wait
start C:\Windows\System32\wusa.exe -argumentlist '/quiet','/norestart','/log:log_exe.evtx',$_.name -wait
$?
}
} else {
'管理者権限がありません';
}
Get-HotFix | format-list > after.txt
diff $(Get-Content before.txt) $(Get-Content after.txt) > install_list.txt
$file1 = "log_msu.evtx"
$file2 = "log_exe.evtx"
$date = Get-Date -format yyyyMMdd
Rename-Item $file1 ($date+"_msu.evtx")
Rename-Item $file2 ($date+"_exe.evtx")
0 件のコメント:
コメントを投稿