We help IT Professionals succeed at work.

power shell script for office 365  password expiry, calendars, focused inbox

hi, i hope you are well.

id like to build a power shell script for 365 to

1) turn off , domain wide, password expiry in office 365
2) set exisitng users calendars to uk location, uk time zone ((unless this can be done domain wide for existing and future)
3) turn off focused inbox for existing users (unless this can be done domain wide for existing and future)
Comment
Watch Question

Alan CoxSr. Architect | Consulting

Commented:
1) turn off , domain wide, password expiry in office 365
Are you using AAD Connect? This would be controlled via Active Directory. ELSE, Get-MSOLUser  | Set-MSOLUser –PasswordNeverExpires $true
OR... Admin center/Settings/Security & Privacy

2) set exisitng users calendars to uk location, uk time zone ((unless this can be done domain wide for existing and future)

https://www.vspbreda.nl/nl/ms-office/office-365/solved-office-365-bulk-set-language-and-time-zone-for-all-users-in-office-365/

3) turn off focused inbox for existing users (unless this can be done domain wide for existing and future)

https://docs.microsoft.com/en-us/office365/admin/setup/configure-focused-inbox?view=o365-worldwide

Author

Commented:
hi alan, thanks for your time

i'll look at the links thanks.

the first bit of code i think just iterates through existing users. i want it off on the whole domain, and i dont want to have to go into the admin centre to do it, i want to add it to my script that makes connectors, turns on dkim etc.

i guess its not possible to domain wide change the calendar options as that doesnt really make much sense,  andt i can see that you could change it for existing users. can the default for a new user be changed  for both requests 2) and 3)
Alan CoxSr. Architect | Consulting

Commented:
set-organizationconfig -focusedinboxon $False

for #1 are you using AAD Connect?

Admin center solution is a one time thing tenant wide.

Author

Commented:
oh top one for the focused inbox! i dont know anyone who likes it. well done.

i have not used aad connect.

i know i can go into the admin centre and turn it off, but it would be great if i can run my first time connect script in PS and have it do all the tedious crap that i might otherwise forget. ms even suggest one of the first things you do is turn it off, and yet they have it turned on by default! crazy!
Sr. Architect | Consulting
Commented:
I, for one, LOVE the focused inbox :) I do a lot of teaching on "managing your mailbox" and I spend a lot of time on focused inbox, search folders, and conditional formatting!

As far as I know from powershell there are only 2 ways to disable expiration:
1. Disable password expiration per user (or bulk as I mentioned) and remember to repeat the process for any newly created users.
2. Sync passwords from an on-premises Active Directory with Azure AD Connect. The sync includes password policies. (not technically powershell so I guess only 1)
decent article on it: https://helgeklein.com/blog/2017/01/disabling-azure-active-directory-password-expiration/

Depending on how many users you have, I would suggest aad connect. Can make your Administration MUCH easier. But it depends.

Author

Commented:
we'll have to agree to disagree on the ficused inbox!

i look after lots of very small companies, so we dont do much else with 365 other than email and office licenses.

ok, i'll wait and see if anyone else has any magic bits of code for turning off password expiry, thanks for your help so far.