Tag: powershell

Office 365: Turn Password Reset Off

To anyone who has had Office 365 for 90 days or more, I am sure you have come to find it extremely useful. Especially to have the ability of having full control of your e-mail, no matter what computer or device you are using. But if you are like me and have also reached that 90 day checkpoint, then you have realised its time to change your password like it or not.

 I logged in on Saturday to check my e-mail only to have it ask me to change my password which I don’t like to do. And yes I know its good security measure to change your password but I don’t like to. Now after much research and reading through command list ontop of a lot of red text in powershell, I got it so that my account doesn’t change require I change my password.

 To do the following you have to use Powershell and if you are using Windows 7, you run it as administrator.If you are using Windows XP, you will have to download the Powershell program found here.

 What follows are the commands in order of how I put them in:

 (You can copy paste into powershell, when you right click in powershell it will paste whats in your clipboard automatically)

 Open Microsoft Online Services PowerShell

These commands will log you in to your account.

 Connect-msolservice

 If you have any problems with that command try running these first:

 $Cred = Get-Credential 

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri -Credential $Cred -Authentication Basic –AllowRedirection

 Import-PSSession $Session

 Once you have successfully logged in, here are the commands to make the password never expire for individual users or an organization.

 

How to check if the “Password never expires” setting is enabled or disabled for a user

Connect to the Microsoft Online Services Module for Windows PowerShell by using your company administrator credentials.

 Run the following command by using the user principal name (UPN) or the Microsoft Online Services ID of the user you want to check:

Get-MSOLUser -UserPrincipalName <Microsoft Online Services ID> | Select PasswordNeverExpires

 Alternatively, to see all users and their “Password never expires setting”, you can run the following PowerShell command:

 Get-MSOLUser | Select UserPrincipalName, PasswordNeverExpires

 

How to enable the “Password never expires” setting

Connect to the Microsoft Online Services Module for Windows PowerShell by using your company administrator credentials.

 Run the following command by using the user principal name (UPN) or the Microsoft Online Services ID of the user to configure the password for that user to never change:

Set-MsolUser -UserPrincipalName <Microsoft Online Services ID> -PasswordNeverExpires $true 

Note If you want to change the setting for all the users in an organization, run the following command:

 Get-MSOLUser | Set-MsolUser -PasswordNeverExpires $true 

 

How to disable the “Password never expires” setting

Connect to the Microsoft Online Services Module for Windows PowerShell (MOSMWP) by using your company administrator credentials. 

Run the following command by using the user principal name (UPN) or the Microsoft Online Services ID of the user to disable the Password never expire setting for that user:

Set-MsolUser -UserPrincipalName  <Microsoft Online Services ID> -PasswordNeverExpires $false

 Note If you want to change the setting for all the users in an organization, use the following cmdlet:

 Get-MSOLUser | Set-MsolUser -PasswordNeverExpires $false

 

Office 365 Send on Behalf

Recently we had a client whom wanted to switch over to Office 365, but had a very unique way of wanting their e-mail to work. They had three e-mail addresses, which for the sake of explaining; I will call a@domain1.com, b@domain2.com and c@domain3.com. They want mail from b@domain2.com and c@domain3.com to go into their a@domain1.com and when an email is send from a@domain1.com it shows up as coming from b@domain2.com.

Still with me? Good.

So at first I tried the simple solution by making the connected accounts which does the e-mail forwarding. This also allowed for me to change the sending address in outlook and the web app outlook which made my day at the time. However the client frequently sends e-mails from her iPhone and the exchange service on the iPhone doesn’t have that “send from” field so this option had to be scrapped.

So after many hours on the phone with Microsoft Office 365 Tech support with some excellent and some not quite as excellent service I came up with nothing. I then found information through searching google and tried the following and it worked:

CAUTION FOLLOW THESE INSTRUCTIONS WORD FOR WORD AND DO NOT, I REPEAT DO NOT SKIP OR OVER DO ANY STEP. I AM NOT LIABLE FOR ANY DAMAGES YOU CAUSE TO YOUR SERVICE!

  1. Firstly you have to add the domain you want to show up in the reply field and here is where my big warning above comes into play. DON’T MOVE ANYTHING OVER!You simple want to go about the same way you would add a domain. Please ensure you have administrative privileges before continuing
    • Log into your Office 365 portal and go to Domains under Management.
    • Click Add a domain.
    • Type in the domain you want to show as the reply ex domain2.com
    • Once that brings you to the next page follow the steps and then Verify
    • DO NOT GO ANY FURTHER! DO NOT CLICK NEXT! CANCEL OUT AFTER IF VERIFIES!
    • Now that we have added the domain and NOT bring over anything we have to fire up powershell and run it as administrator. You will need to activate redirecting if you have not already done so by typing this command in first:

→ Set-ExecutionPolicy Unrestricted

And then say yes to the following prompt.

  1. Now that you are allowed to redirect you now have to follow through with these commands:
  2. →$LiveCred = Get-Credential
  3. →$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri -Credential $LiveCred -Authentication Basic –  AllowRedirection
  4. → Import-PSSession $Session
  5. →Set-Mailbox  <insert primary e-mail here> -EmailAddresses SMTP:<Insert reply as email here>         (This is an Ex.  Set-Mailbox a@domain1.com –EmailAddresses SMTP: b@domain2.com)
  6. Now, if all goes well, you go back into you 365 portal, go to Outlook and then once in there go to Options, then select in the drop down See all Options… when that loads you are going to want to select Manage my Organization, then on the left side click on Mail Control and go to Domains & Protection. In here you select the domain you want as the Reply As and click Details and the when the pop up window come up switch from Hosted to Shared.
  7. Voilà! You are now done and everything should work nicely.