Connect-AzureAD
# Get group by name
$group = Get-AzureADGroup -SearchString 'My group'
# Get members
$members = Get-AzureADGroupMember -ObjectId $group.ObjectId -All:$true
# Get password
$password = Read-host -AsSecureString -Prompt "Password"
$VerbosePreference = "Continue"
$inc = 1
$members | Foreach {
Write-Verbose "$($inc) / $($members.Count) - $($_.UserPrincipalName)"
$inc += 1
Set-AzureADUserPassword -ObjectId $_.ObjectId -ForceChangePasswordNextLogin:$true -Password $password
}
Like this:
Like Loading...
Related