Install-Module MSOnline Import-Module MSOnline Connect-MsolService
# Get licensed users
$licensedUsers = Get-MsolUser -All | Where-Object {$_.IsLicensed -eq $true}
# Set ForceChangePassword True for $licensedUsers
foreach ($user in $licensedUsers) {
Set-MsolUserPassword -UserPrincipalName $user.UserPrincipalName -ForceChangePasswordOnly $true -ForceChangePassword $true
}
Disconnect-MsolService