AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 1067287
Accepted
fusione_2008
fusione_2008
Asked: 2021-06-21 20:05:22 +0800 CST2021-06-21 20:05:22 +0800 CST 2021-06-21 20:05:22 +0800 CST

Get-EventLog -Log“Microsoft-Windows-Ntfs/Operational”因“不存在”而失败

  • 772

我正在制作一个脚本,它可以提取所有非空日志并将它们保存为 evtx、csv 或 xml。我已经让脚本适用于基本日志(应用程序、安全性、系统等)以及那些有空格的日志。但是,我不断收到任何带有正斜杠(/)的错误(例如Microsoft-Windows-Ntfs/Operational)。我尝试用破折号、空格、缩写和下划线交换/出来:它们都会导致下面的错误。

注意:我-newest 20在代码中用于测试,以减轻负载并节省时间。

代码示例(获得相同的结果):

get-eventlog -log "Microsoft-Windows-Ntfs/Operational" -newest 20

或者

$Logname = "Microsoft-Windows-Ntfs/Operational"
get-eventlog -log $logname -newest 20`

错误:

get-eventlog : The event log 'Microsoft-Windows-Ntfs/Operational' on computer '.' does not exist.
At line:1 char:1
+ get-eventlog -log "Microsoft-Windows-Ntfs/Operational" -newest 20
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-EventLog], InvalidOperationException
    + FullyQualifiedErrorId : System.InvalidOperationException,Microsoft.PowerShell.Commands.GetEventLogCommand
windows powershell windows-event-log
  • 1 1 个回答
  • 437 Views

1 个回答

  • Voted
  1. Best Answer
    papanito
    2021-06-22T04:29:31+08:002021-06-22T04:29:31+08:00

    Get-EventLog只看到这个

    > get-eventlog -List
    
      Max(K) Retain OverflowAction        Entries Log
      ------ ------ --------------        ------- ---
      20’480      0 OverwriteAsNeeded      18’888 Application
      20’480      0 OverwriteAsNeeded           0 HardwareEvents
         512      7 OverwriteOlder              0 Internet Explorer
      20’480      0 OverwriteAsNeeded           0 Key Management Service
      15’360      0 OverwriteAsNeeded      19’094 Operations Manager
                                                  Security
       8’192      0 OverwriteAsNeeded       7’012 Symantec Endpoint Protection Client
      20’480      0 OverwriteAsNeeded     102’800 System
      15’360      0 OverwriteAsNeeded      14’144 Windows PowerShell
    

    此外,该文件还指出

    Get-EventLog使用已弃用的 Win32 API。结果可能不准确。使用`Get-WinEvent? cmdlet 代替。

    因此使用Get-WinEvent,它工作正常:

    Get-WinEvent -LogName "Microsoft-Windows-Ntfs/Operational"
    
    
       ProviderName: Microsoft-Windows-Ntfs
    
    TimeCreated                     Id LevelDisplayName Message
    -----------                     -- ---------------- -------
    21.06.2021 01:24:48            142 Information      Summary of disk space usage, since last event:...
    21.06.2021 01:24:38            142 Information      Summary of disk space usage, since last event:...
    21.06.2021 01:24:38            142 Information      Summary of disk space usage, since last event:...
    20.06.2021 01:24:44            142 Information      Summary of disk space usage, since last event:...
    
    • 1

相关问题

  • 知道任何适用于 Windows 的快速可编写脚本的 ftp 客户端吗?[关闭]

  • 如果 Windows 服务崩溃,如何自动重新启动它?

  • 无法安排任务(访问被拒绝)

  • 物理机重启时自动重启虚拟机(VMWare)

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve