Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
NikCharlebois committed Mar 29, 2023
1 parent 455d7c4 commit c394c8a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@
* Major changes to the export process where resource instances will now be assigned a meaningful nam
that will follow the ResourceName-PrimaryKey convention.
* Added a fix making sure that the progress bar "Scanning dependencies" is no longer displayed after the operation is completed.

* Changed configuration drift reporting to event log to include the instance name as the source.
FIXES [#2981](https://github.com/microsoft/Microsoft365DSC/issues/2981)

# 1.23.322.1

Expand Down
6 changes: 3 additions & 3 deletions Modules/Microsoft365DSC/Modules/M365DSCLogEngine.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -691,14 +691,13 @@ function Get-M365DSCCurrentResourceInstanceNameFromLogs
[System.String]
$ResourceName
)

try
{
$allEvents = Get-WinEvent -LogName "Microsoft-windows-dsc/operational" -MaxEvents 25
$allEvents = Get-WinEvent -LogName "Microsoft-windows-dsc/operational" -MaxEvents 10
foreach ($event in $allEvents)
{
$message = $event.Message
$stringToFind = "Resource execution sequence :: [$ResourceName]"
$stringToFind = "Resource execution sequence :: [$($ResourceName.Split('_')[1])]"
$start = $message.IndexOf($stringToFind)
if ($start -ge 0)
{
Expand All @@ -717,6 +716,7 @@ function Get-M365DSCCurrentResourceInstanceNameFromLogs
Export-ModuleMember -Function @(
'Add-M365DSCEvent',
'Export-M365DSCDiagnosticData',
'Get-M365DSCCurrentResourceInstanceNameFromLogs',
'New-M365DSCLogEntry',
'Get-M365DSCNotificationEndPointRegistration',
'New-M365DSCNotificationEndPointRegistration',
Expand Down
2 changes: 1 addition & 1 deletion Modules/Microsoft365DSC/Modules/M365DSCUtil.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@ function Test-M365DSCParameterState
$currentInstanceName = $Source
}
$EventMessage = "<M365DSCEvent>`r`n"
$EventMessage += " <ConfigurationDrift Source=`"$Source`">`r`n"
$EventMessage += " <ConfigurationDrift Source=`"$Source`" InstanceName=`"$currentInstanceName`">`r`n"

$EventMessage += " <ParametersNotInDesiredState>`r`n"
foreach ($key in $DriftedParameters.Keys)
Expand Down

0 comments on commit c394c8a

Please sign in to comment.