【发布时间】:2017-10-11 14:04:36
【问题描述】:
我正在尝试同时获取 «EventLog» 日志 «Application»、«Security» 和 «System» 中的最后 10 个事件。我收到一条错误消息:
Get-EventLog : 无法将 'System.Object[]' 转换为参数 'LogName' 所需的类型 'System.String'"
运行脚本时。该脚本在仅使用日志名称“Application”运行时有效。
Get-Eventlog -Newest 10 -LogName "Application","Security","System"
【问题讨论】:
-
这是因为 LogName 需要一个字符串,而您正在放入一个数组
标签: powershell