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