【发布时间】:2022-12-16 02:50:23
【问题描述】:
我正在运行一个脚本,用于收集和清除网络上每台机器的事件日志。 出于某种原因,当脚本到达需要清除工作站事件日志的部分时,它会抛出一条错误消息“无法找到 [computer] 的路径”。 该网络从连接到由 VMware 管理的网络的多个物理工作站的标准设置切换而来。它混合了虚拟服务器/工作站和物理工程工作站。
当我使用的脚本是没有虚拟工作站/服务器的更标准的设置时,它可以正常工作。
所有服务器和工作站名称都存储在一个数组中并调用到函数中 “clear-eventlog -logname application, system, security -computername $var”,$var 从名称数组调用。
我知道计算机在阵列中没有被错误命名,因为它可以毫无问题地从工作站提取审计日志,也可以毫无问题地清除虚拟服务器的审计日志。
只有当它试图从物理工作站清除审计日志时才会抛出错误,所以我认为这可能是某种权限问题导致审计日志对“清除事件日志”功能不可见,但我一直无法弄清楚如何绕过它。
我如何才能清除物理工作站的日志?
#not exact, rewriting from memory
#skipping over most of the script, but this is the section thats throwing an error
@var = @(server1, server2, workstation1, workstation2, etc)
##issue with this part only when clearing physical workstation logs
clear-eventlog -LogName Application, Security, System, "Symantec Endpoint Protection Client" -computername $var
##error message
"path to [workstation name] cannot be found"
【问题讨论】:
标签: powershell event-log audit