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 於 124 天前認領。 未關閉chore
難度 4/5 3-5 天 新手友好度 64/100
-
難度 2/5 1-3 小時 新手友好度 55/100
-
Computer: AD object deletion before domain join issue可能已有人在做 @Daymarvi 於 127 天前認領。 未關閉
難度 4/5 3-5 天 新手友好度 35/100
查看 dsccommunity/ComputerManagementDsc 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 73/100
-
難度 2/5 1-3 小時 新手友好度 65/100
-
難度 2/5 1-3 小時 新手友好度 77/100
pi-hole/docker-pi-hole#2087 ·
-
[security] storybook — code injection into the dev server and preview (critical, frontend, dev-only)未關閉dependencies in-review P0 security
難度 2/5 1-3 小時 新手友好度 76/100
jwilleke/yourphr#963 · 1 則留言 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 67/100