Created
December 7, 2018 12:23
-
-
Save mczerniawski/8a9b03a4a9d00b0a61f70698fe4d9294 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$UsersToClean = Get-Content -Path 'c:\AdminTools\disabled_onlinemembership.json ' -RAW | ConvertFrom-Json | |
#Remove from groups | |
foreach ($onlineUser in $UsersToClean) { | |
Write-Host "Processing user {$($onlineUser.DisplayName)}" | |
foreach ($group in $onlineUser.AADGroupID) { | |
Write-Host " Processing group {$($group)}" | |
Remove-AzureADGroupMember -ObjectId $group -MemberId $onlineUser.AADUserObjectID | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Getting the error Remove-AzureADGroupMember : Cannot bind argument to parameter 'MemberId' because it is null.