Get-WinEvent instead of Get-EventLog
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 55/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 停滞
- 技术栈
- powershell
调研方向
检查第 717 行和第 971 行附近的 Get-WindowsEventLogRestrictGuestAccess 和 Set-WindowsEventLogRetentionDays,从报告的 Get-EventLog 调用开始。将这些调用替换为建议的 Get-WinEvent 查询,然后验证 WindowsEventLog 资源是否能在 Windows Server 2019 上与 PowerShell 7 正常工作。
由索引模型根据 Issue 内容生成。
描述
Problem description
Get-EventLog is deprecated in favor of Get-WinEvent and when trying to use WindowsEventLog from ComputerManagemntDsc with GuestConfig Agent I am getting an error message like the following
Verbose logs
The term 'Get-EventLog' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. The PowerShell DSC resource '[WindowsEventLog]LOG_NAME' with SourceInfo 'E:\agent\_work\1212\dev\build\configurations\dev\WindowsEventLog_LOG_NAME.ps1::6::9::WindowsEventLog' threw one or more non-terminating errors while running the Test-TargetResource functionality. These errors are logged to the ETW channel called Microsoft-Windows-DSC/Operational. Refer to this channel for more details. The SendConfigurationApply function did not succeed. LCM failed to start desired state configuration manually.
DSC configuration
Configuration WindowsEventLog_LOG_NAME
{
Import-DSCResource -Name WindowsEventLog -ModuleName ComputerManagementDsc -ModuleVersion 10.0.0
Node localhost
{
WindowsEventLog LOG_NAME
{
LogName = 'LOG_NAME'
RegisteredSource = 'LOG_NAME'
IsEnabled = $true
}
}
}
WindowsEventLog_LOG_NAME -OutputPath .\mof-files\WindowsEventLog_LOG_NAME\
Suggested solution
Remove Get-EventLog from the following functions Get-WindowsEventLogRestrictGuestAccess and Set-WindowsEventLogRetentionDays
Replace 717 and 971 with the following code
$matchingEventLog = Get-WinEvent -ListLog $Logname -ErrorAction Stop
Operating system the target node is running
OsName : Microsoft Windows Server 2019 Standard
PowerShell version and build the target node is running
PowerShell ver 7 is what our build and deploy pipeline are running
ComputerManagementDsc version
Version 10
- 主要语言
- PowerShell
- 星标
- 338
- 派生
- 80
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
dsccommunity/ComputerManagementDsc 的其他 Issue
-
chore
难度 2/5 1-3 小时 新手友好度 78/100
-
chore
难度 4/5 3-5 天 新手友好度 68/100
-
chore: Add Agentic AI development assets for GitHub Copilot可能已有人在做 @PlagueHO 于 120 天前认领。 未关闭chore
难度 4/5 3-5 天 新手友好度 64/100
-
难度 2/5 1-3 小时 新手友好度 55/100
-
Computer: AD object deletion before domain join issue可能已有人在做 @Daymarvi 于 123 天前认领。 未关闭
难度 4/5 3-5 天 新手友好度 35/100
查看 dsccommunity/ComputerManagementDsc 的全部 Issue
相似的 Issue
-
e2e-failure ready-to-code
难度 2/5 1-3 小时 新手友好度 68/100
redhat-developer/rhdh-plugin-export-overlays#4460 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 84/100
vladmandic/sdnext#5161 ·
维护者通常 1 天内回复
-
Agent ignores WOODPECKER_KEEPALIVE_TIME and WOODPECKER_KEEPALIVE_TIMEOUT (flag name mismatch)可能已有人在做 @Mihir-Rabari 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 84/100
woodpecker-ci/woodpecker#7350 ·
维护者通常 1 天内回复
-
难度 1/5 1-3 小时 新手友好度 78/100
krizaka/krizaka-notifications#22 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
hiero-ledger/solo-containers#254 ·
维护者通常 1 天内回复