我有一个 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'
Run Code Online (Sandbox Code Playgroud)
我虽然语法是正确的,但收到一条错误消息。
Write-EventLog: The term 'Write-EventLog' is not recognized as a name of a cmdlet, function, script file, or executable program.
Run Code Online (Sandbox Code Playgroud)
检查名称的拼写,或者如果包含路径,请验证路径是否正确,然后重试。
有人知道我做错了什么吗?
任何帮助表示赞赏。