From 73863afdc6a258369d0ccf92886292d7b3571078 Mon Sep 17 00:00:00 2001 From: Przemyslaw Klys Date: Tue, 17 May 2022 21:39:34 +0200 Subject: [PATCH] Fixes an issue when domain is missing #16 --- Private/ScriptBlock.ps1 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Private/ScriptBlock.ps1 b/Private/ScriptBlock.ps1 index 1d772ee..475646d 100644 --- a/Private/ScriptBlock.ps1 +++ b/Private/ScriptBlock.ps1 @@ -787,6 +787,8 @@ $Script:ScriptBlock = { } if ($Event.TargetDomainName -and $Event.TargetUserName) { Add-Member -InputObject $Event -MemberType NoteProperty -Name 'ObjectAffected' -Value "$($Event.TargetDomainName)\$($Event.TargetUserName)" -Force + } elseif ($Event.TargetUserName) { + Add-Member -InputObject $Event -MemberType NoteProperty -Name 'ObjectAffected' -Value "$($Event.TargetUserName)" -Force } if ($Event.MemberName) { [string] $MemberNameWithoutCN = $Event.MemberName -replace 'CN=|\\|,(OU|DC|CN).*$'