我有一个powershell脚本,我想将其添加到事件日志中。
当我输入Write-Eventlog命令时,会收到错误消息。
Write-EventLog -Logname autosnapshot -Source 'D:\script autoSnapshots.ps1' -EventId 8000 -Entrytype Information -Message 'Creates Snapshots and deletes snapshots older than 1 day'
我认为语法是正确的,但我收到了错误信息。
Write-EventLog: The term 'Write-EventLog' is not recognized as a name of a cmdlet, function, script file, or executable program.
请检查名称的拼写,如果包含路径,请验证路径是否正确,然后重试。
有人知道我做错了什么吗?
非常感谢您的帮助。