To be able to run commands that affect user accounts you must install the Microsoft Online Services Module for PowerShell which can be found here which also requires the single sign on tool located here.
To connect to Office 365 with PowerShell run the following 4 commands. You will be prompted for your account credentials.
set-executionpolicy remotesigned $LiveCred = Get-Credential $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirection Import-PSSession $SessionTo connect to the user management service issue the following
connect-msolserviceTo set a users password to something you know and set them to not have to change it
Set-MsolUserPassword -UserPrincipalName CHANGETO@USERNAME -NewPassword SETTHISTOTHENEWPW -ForceChangePassword $falseTo set all users to not have to change password every 90 days
Get-MsolUser | Set-MsolUser –PasswordNeverExpires $True
No comments:
Post a Comment