■以下のようにバッチファイルに記述するとバッチからPowerShellが実行出来る@echo off
PowerShell -command "Write-Output '--- --- --- --- --- --- --- --- --- --- --- --- --- ---'"
PowerShell -command "Write-Output '★★★ 開始 ★★★'"
PowerShell -command "Write-Output '--- --- --- --- --- --- --- --- --- --- --- --- --- ---'"
PowerShell -command "Write-Output ' '"
PowerShell -command "Write-Output '▲▼▲▼▲▼ ホスト名 ▲▼▲▼▲▼'"
PowerShell -command "hostname"
PowerShell -command "Write-Output '--- --- --- --- --- --- --- --- --- --- --- --- --- ---'"
PowerShell -command "Write-Output '▲▼▲▼▲▼ 日時 ▲▼▲▼▲▼'"
PowerShell -command "Get-Date -Format 'yyyy/MM/dd HH:mm'"
PowerShell -command "Write-Output '--- --- --- --- --- --- --- --- --- --- --- --- --- ---'"
PowerShell -command "Write-Output '▲▼▲▼▲▼ パッチ情報(降順) ▲▼▲▼▲▼'"
PowerShell -command "Get-HotFix | Where-Object HotFixID -match "KB" | Sort-Object -Descending InstalledOn"
PowerShell -command "Write-Output '--- --- --- --- --- --- --- --- --- --- --- --- --- ---'"
PowerShell -command "Write-Output '▲▼▲▼▲▼ 最近のOS起動の日時 ▲▼▲▼▲▼'"
PowerShell -command "Get-EventLog System | Where-Object {$_.InstanceId -eq "12" } | Select-Object -First 1"
PowerShell -command "Write-Output '--- --- --- --- --- --- --- --- --- --- --- --- --- ---'"
PowerShell -command "Write-Output '▲▼▲▼▲▼ システムイベント(エラー) ▲▼▲▼▲▼'"
PowerShell -command "Get-EventLog System | Where-Object {$_.EntryType -eq 'Error'} | Select-Object -First 50"
PowerShell -command "Write-Output '--- --- --- --- --- --- --- --- --- --- --- --- --- ---'"
pause
PowerShell -command "Write-Output '▲▼▲▼▲▼ システムイベント(警告) ▲▼▲▼▲▼'"
PowerShell -command "Get-EventLog System | Where-Object {$_.EntryType -eq 'Warning'} | Select-Object -First 50"
PowerShell -command "Write-Output '--- --- --- --- --- --- --- --- --- --- --- --- --- ---'"
pause
rem PowerShell -command "Write-Output '▲▼▲▼▲▼ アプリケーションイベント(エラー) ▲▼▲▼▲▼'"
rem PowerShell -command "Get-EventLog Application | Where-Object {$_.EntryType -Like 'Error'} | Select-Object -First 30"
rem PowerShell -command "Write-Output '--- --- --- --- --- --- --- --- --- --- --- --- --- ---'"
rem pause
rem PowerShell -command "Write-Output '▲▼▲▼▲▼ アプリケーションイベント(警告) ▲▼▲▼▲▼'"
rem PowerShell -command "Get-EventLog Application | Where-Object {$_.EntryType -Like 'Warning'} | Select-Object -First 30"
rem PowerShell -command "Write-Output '--- --- --- --- --- --- --- --- --- --- --- --- --- ---'"
rem pause
PowerShell -command "Write-Output ' '"
PowerShell -command "Write-Output '--- --- --- --- --- --- --- --- --- --- --- --- --- ---'"
PowerShell -command "Write-Output '★★★ 終了 ★★★'"
PowerShell -command "Write-Output '--- --- --- --- --- --- --- --- --- --- --- --- --- ---'"
pause
PR