![]() ![]() PS C:\> Get-MsolUser | Where-Object | Select-Object UserPrincipalName | Sort-Object UserPrincipalName > c:\users.txt PowerShell Script to force users to change their password Extract every licenced users to a text file :.PS C:\> Get-MsolUser -SearchString cartman PS C:\> Set-MsolUserPassword -UserPrincipalName -ForceChangePasswordOnly $true -ForceChangePassword $true Misc -ForceChangePasswordOnly : prevents the command Set-MsolUserPassword from generating a random password ( source).After this command, the update password procedure will happen next time user will connect (it will be slower to apply with Outlook clients because it uses a cache mechanism) :.PS C:\> Set-MsolUserPassword -UserPrincipalName -NewPassword NewPassw0rd -ForceChangePassword $False Force user to change password at next logon -ForceChangePassword : Indicates whether the user must change the password the next time they sign in.With this command we can set a password for a user :.Use Connect-MsolService to open the Microsoft Office 365 sign in window :. ![]() PS C:\> Install-Module -Name MSOnline Connect to Office 365 Open a PowerShell prompt with administrator rights :. ![]() We will need MSOnline module to connect to Office 365 with PowerShell. We will see here how to force users to change their Office 365 password.įirst we will see how to do it for one account then we will see how to do it for multiple accounts. Office 365 : How to force users to change their password ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |