fixed erroneous adding of user in remove function

This commit is contained in:
Karl-Wilfried Zimmer 2024-07-14 20:05:25 +02:00
parent 81898676ed
commit fa67132086

View File

@ -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}
}