Get-WinEvent instead of Get-EventLog
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Anfängerfreundlichkeit
- 55/100
- Issue-Typ
- Bug
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Veraltet
- Tech-Stack
- powershell
- Bereich
- devops, operating-systems
Rechercherichtung
Untersuchen Sie Get-WindowsEventLogRestrictGuestAccess und Set-WindowsEventLogRetentionDays in der Nähe der Zeilen 717 und 971, beginnend mit den gemeldeten Get-EventLog-Aufrufen. Ersetzen Sie diese Aufrufe durch die vorgeschlagene Get-WinEvent-Abfrage und überprüfen Sie anschließend, dass die WindowsEventLog-Ressource mit PowerShell 7 unter Windows Server 2019 funktioniert.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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
- Vorherrschende Sprache
- PowerShell
- Sterne
- 338
- Forks
- 80
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus dsccommunity/ComputerManagementDsc
-
chore
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
-
chore
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 68/100
-
chore: Add Agentic AI development assets for GitHub CopilotEvtl. vergeben @PlagueHO hat das vor 120 Tagen übernommen. Offenchore
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 64/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 55/100
-
Computer: AD object deletion before domain join issueEvtl. vergeben @Daymarvi hat das vor 123 Tagen übernommen. Offen
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 35/100
Alle Issues in dsccommunity/ComputerManagementDsc
Ähnliche Issues
-
bug
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 86/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 64/100
Maintainer antworten meist innerhalb von 3 Tagen
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 85/100
facebookincubator/muse-gadget-sdk#249 ·
Maintainer antworten meist innerhalb von 1 Tag
-
debt
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
microsoft/vscode-flake8#601 ·
Maintainer antworten meist innerhalb von 1 Tag
-
KB infra drift: deployed estate changedEvtl. vergeben @chd-ds-kb-steward hat das heute übernommen. Offenkb-infra-drift
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
OCHA-DAP/ds-knowledge-base#792 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag