Following on from the previous post, here is the complete script. Copy and paste it into Powershell.
It will ask for Id and PW twice, please input.
$LiveCred = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirection
Import-PSSession $Session
Connect-Msolservice
Get-MsolUser | Set-MsolUser -PasswordNeverExpires $true
Get-MsolUser | Select UserPrincipalName, PasswordNeverExpires