当我在powershell上逐个运行下面的命令时,我得到了预期的结果。但是,当我将它作为PS脚本运行时,我没有得到任何输出。
$StartDate = Get-Date
Write-EventLog -LogName Application -Source "MsiInstaller" -EventId 11707 -Message "Product: Installation operation completed successfully."
Get-EventLog Application -After "$StartDate" -Source "MsiInstaller"遗漏了什么?
发布于 2015-04-01 19:28:59
这是事件日志的准确性,当您在脚本中运行它时,所有这些都在同一秒内发生。
试试这个:
$StartDate = Get-Date
Write-EventLog -LogName Application -Source "MsiInstaller" -EventId 11707 -Message "Product: Installation operation completed successfully."
start-sleep(1)
Get-EventLog Application -After "$StartDate" -Source "MsiInstaller"https://stackoverflow.com/questions/29388275
复制相似问题