You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Use the Get-ADSanitizedGroupName function if data manipulation is needed. For example, when using a name instead of a code or when you also use this function in the resource script
if ($actionContext.Configuration.renameResources-and ($currentADGroup.Name-ne$groupName-or$currentADGroup.DisplayName-ne$groupName)) {
321
327
if (-Not($actionContext.DryRun-eq$True)) {
322
328
323
-
Write-Information"Debug: Group where [$($correlationProperty)] = [$($correlationValue)] already exists, but will be renamed"
329
+
if ($actionContext.Configuration.isDebug-eq$true) { Write-Information"Debug: Group where [$($correlationProperty)] = [$($correlationValueOutput)] already exists, but will be renamed" }
324
330
325
331
$SetADGroupParams=@{
326
-
Identity=$currentADGroup.objectguid
327
-
DisplayName=$groupName
328
-
Server=$pdc
332
+
Identity=$currentADGroup.objectguid
333
+
DisplayName=$groupName
334
+
Server=$pdc
329
335
}
330
336
$null=Set-AdGroup@SetADGroupParams
331
337
332
338
$RenameADGroupParams=@{
333
-
Identity=$currentADGroup.objectguid
334
-
NewName=$groupName
335
-
Server=$pdc
339
+
Identity=$currentADGroup.objectguid
340
+
NewName=$groupName
341
+
Server=$pdc
336
342
}
337
343
$null=Rename-ADObject@RenameADGroupParams
338
344
339
345
$outputContext.AuditLogs.Add([PSCustomObject]@{
340
-
Message="Renaming group [$($correlationProperty)] = [$($correlationValue)] for resource [$($resource|ConvertTo-Json)]."
346
+
Message="Renaming group [$($correlationProperty)] = [$($correlationValueOutput)] for resource [$($resource|ConvertTo-Json)]."
341
347
Action="CreateResource"
342
348
IsError=$false
343
349
})
@@ -347,8 +353,7 @@ try {
347
353
if ($actionContext.Configuration.isDebug-eq$true) { Write-Information"Debug: Group parameters: $($ADGroupParams|ConvertTo-Json)" }
348
354
}
349
355
}
350
-
else
351
-
{
356
+
else {
352
357
# Create new group if group does not exist yet
353
358
if (-Not($actionContext.DryRun-eq$True)) {
354
359
if ($actionContext.Configuration.isDebug-eq$true) {
0 commit comments