From fa6713208612c85ecebca91e6c3b5a30ecf7e548 Mon Sep 17 00:00:00 2001 From: Karl-Wilfried Zimmer Date: Sun, 14 Jul 2024 20:05:25 +0200 Subject: [PATCH] fixed erroneous adding of user in remove function --- RemoveUser.ps1 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/RemoveUser.ps1 b/RemoveUser.ps1 index 1a71be5..2a44561 100644 --- a/RemoveUser.ps1 +++ b/RemoveUser.ps1 @@ -37,9 +37,9 @@ if($null -eq $User){ } if($PSBoundParameters.ContainsKey("Server")){ - $Group = . .\GetProjects.ps1 -Server $Server + $Group = . .\GetProjects.ps1 -Server $Server -ProjectName $ProjectName } else { - $Group = . .\GetProjects.ps1 + $Group = . .\GetProjects.ps1 -ProjectName $ProjectName } if($null -eq $Group){ @@ -61,7 +61,7 @@ if($null -eq $Group){ } if($PSBoundParameters.ContainsKey("Server")){ - $targeGroup | ForEach-Object {Add-ADGroupMember -Identity $_ -Members $Identity -Server $Server} + $targeGroup | ForEach-Object {Remove-ADGroupMember -Identity $_ -Members $Identity -Server $Server} } else { - $targeGroup | ForEach-Object {Add-ADGroupMember -Identity $_ -Members $Identity} + $targeGroup | ForEach-Object {Remove-ADGroupMember -Identity $_ -Members $Identity} } \ No newline at end of file