0
この非常に便利でシンプルなpowershellスクリプトを使って、イベントログを書きました。 私の問題は、イベントメッセージとして結果を書きたいということです。 $ result変数に似ているが、画面に表示されたものと正確には一致しないものがある。誰かが私に正しい方向を向けることができますか?Powershell変数の結果をイベントログに追加
begin {
$EventHashInformation = @{
LogName = 'Application'
Source = 'My Script'
EventId = 2783
EntryType = 'Information'
}
$EventHashWarning = @{
LogName = 'Application'
Source = 'My Script'
EventId = 2784
EntryType = 'Warning'
}
Write-EventLog @EventHashInformation -Message 'Script started'
}
process {
try {
$result = Get-CimInstance -ClassName Win32_Bios -ErrorAction Stop
Write-EventLog @EventHashInformation -Message $result
} catch {
Write-EventLog @EventHashWarning -Message 'Error occurred while queried Win32_Bios'
}
}
end {
Write-EventLog @EventHashInformation -Message 'Script finished'
}
これは、これは私が(PowerShellでスクリーン印刷)必要なものである私は、イベントログに何を得る
Win32_BIOS: BIOS Date: 05/23/12 17:15:53 Ver: 09.00.06 (Name = "BIOS Date: 05/23/12 17:15:53 Ver: 09.0..., SoftwareElementID = "BIOS Date: 05/23/12 17:15:53 Ver: 09.0..., SoftwareElementState = 3, TargetOperatingSystem = 0, Version = "VRTUAL - 5001223") : %2
ある
SMBIOSBIOSVersion : 60KT38AUS
Manufacturer : LENOVO
Name : Lenovo ThinkStation BIOS Ver 60KT38.0
SerialNumber : MJWNY54
Version : LENOVO - 60400d0
あなたはあなたが何を期待しているかを知ることができますか? ng? – ArcSet