{"id":45,"date":"2012-10-22T22:59:00","date_gmt":"2012-10-22T22:59:00","guid":{"rendered":"\/myblog\/elvis\/post\/2012\/10\/22\/Changing-Office365-password-policy-with-PowerShell.aspx"},"modified":"2012-10-22T22:59:00","modified_gmt":"2012-10-22T22:59:00","slug":"changing-office365-password-policy-with-powershell","status":"publish","type":"post","link":"https:\/\/em-soft.si\/myblog\/elvis\/?p=45","title":{"rendered":"Changing Office365 password policy with PowerShell"},"content":{"rendered":"<p><span style=\"font-size: medium; font-family: times new roman,times;\">I want to spend some words about changing password policy in Office 365, where ADFS is not installed. In these cases, we have usually two passwords &#8211; one for local system and one for online environment. This is an exception in Essentials server, because it is possible to synchronize on premise and online environment, but we can do some nice things also in other environments with few PowerShell commands. The thing that is really not good and is not possible to change is the password structure. We must preserve password 8 to 16 characters long and with allowed characters (<a href=\"http:\/\/community.office365.com\/en-us\/wikis\/administration\/characters-in-passwords-or-user-names-in-office-365.aspx\">http:\/\/community.office365.com\/en-us\/wikis\/administration\/characters-in-passwords-or-user-names-in-office-365.aspx<\/a>). <\/span><br \/>\n<span style=\"font-size: medium; font-family: times new roman,times;\">Anyway, you can change some settings like password age, password expiration and you can do this for user or for domain. The first thing, that you have to do, is install Office 365 cmdlets from this link (<a href=\"http:\/\/onlinehelp.microsoft.com\/office365-enterprises\/hh124998.aspx\">http:\/\/onlinehelp.microsoft.com\/office365-enterprises\/hh124998.aspx<\/a>). On this point, you have to install two things: Microsoft Online Services Sign-In Assistant and Microsoft Online Services Module for Windows PowerShell. After this operation,you are ready to begin. <\/span><br \/>\n<span style=\"font-size: medium; font-family: times new roman,times;\">The first step to do is connecting to Office 365 environment. For this you need three simple PowerShell commands and credentials of administrative account:<\/span><br \/>\n<span style=\"font-size: medium; font-family: terminal,monaco;\">Import-Module MSOnline<\/span><br \/>\n<span style=\"font-size: medium; font-family: terminal,monaco;\">$O365Cred = Get-Credential<\/span><br \/>\n<span style=\"font-size: medium; font-family: terminal,monaco;\">Connect-MsolService -Credential $O365Cred<\/span><br \/>\n<span style=\"font-size: medium; font-family: times new roman,times;\">After this you can change password policy with command <span style=\"font-family: terminal,monaco;\">Set-MsolPasswordPolicy -ValidityPeriod 60 -NotificationDays 14 -DomainName domain.com<\/span>, which will change policy for domain named domain.com. The password validity period will be 60 days with notification to change password 14 days before it will expire.<\/span><br \/>\n<span style=\"font-size: medium; font-family: times new roman,times;\">If you want to set password never expire to user, you have to do user by user with command <span style=\"font-family: terminal,monaco;\">Set-MsolUser -UserPrincipalName &lt;user ID&gt; -PasswordNeverExpires $true<\/span>. Of course is possible to automate also this task and for example, if you want to do this step for all users it is very simple: <span style=\"font-family: terminal,monaco;\">Get-MSOLUser | Set-MsolUser -PasswordNeverExpires $true<\/span>.<\/span><\/p>\n<p><span style=\"font-size: medium; font-family: times new roman,times;\">Good work.<\/span><a style=\"text-decoration:none\" href=\"\/index.php?s=viagra-oral-jelly-cheapest-price\">.<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I want to spend some words about changing password policy in Office 365, where ADFS is not installed. In these cases, we have usually two passwords &#8211; one for local system and one for online environment. This is an exception in Essentials server, because it is possible to synchronize on premise and online environment, but [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,15],"tags":[37,40],"class_list":["post-45","post","type-post","status-publish","format-standard","hentry","category-office-365","category-windows-server","tag-office-365","tag-windows-server"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/em-soft.si\/myblog\/elvis\/index.php?rest_route=\/wp\/v2\/posts\/45","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/em-soft.si\/myblog\/elvis\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/em-soft.si\/myblog\/elvis\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/em-soft.si\/myblog\/elvis\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/em-soft.si\/myblog\/elvis\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=45"}],"version-history":[{"count":0,"href":"https:\/\/em-soft.si\/myblog\/elvis\/index.php?rest_route=\/wp\/v2\/posts\/45\/revisions"}],"wp:attachment":[{"href":"https:\/\/em-soft.si\/myblog\/elvis\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=45"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/em-soft.si\/myblog\/elvis\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=45"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/em-soft.si\/myblog\/elvis\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=45"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}