當我在PowerShell上一個接一個地運行下面的命令時,我得到了預期的結果。但是,當我將它作爲PS腳本運行時,我沒有得到任何輸出。Get-EventLog - 查詢後
$StartDate = Get-Date
Write-EventLog -LogName Application -Source "MsiInstaller" -EventId 11707 -Message "Product: Installation operation completed successfully."
Get-EventLog Application -After "$StartDate" -Source "MsiInstaller"
缺少什麼?
是PowerShell的允許執行腳本? (嘗試'get-executionPolicy') – 2015-04-01 11:27:51