Change Office 365 password expiration policy

office365

The default password expiration policy of Office 365 is set to 90 days. That means that users have to change their password every 90 days. I think basicly this is a good and secure policy but maybe your company has other security policy or for some other reason you have to deactivate this. We can change this setting through PowerShell with the MicrosoftOnline PowerShell Module.

  1. First connect to Office 365 via PowerShell more on this here
  2. Now you can use the following cmdlet
    Set-MsolUser -UserPrincipalName user@contoso.com –PasswordNeverExpires $true

 

How to download files with Powershell

Powershell HeaderThis should show you how you can download a file with Powershell. This is not a script or function you should use. It just is the the easyiest way to download a file with Powershell. If I have enough time I will create a function for downloading files.

$Url = "http://www.thomasmaurer.ch/ps.txt"
$Path = "C:\temp\ps.txt"
$Username = ""
$Password = ""

$WebClient = New-Object System.Net.WebClient
$WebClient.Credentials = New-Object System.Net.Networkcredential($Username, $Password)
$WebClient.DownloadFile( $url, $path )

How can I check the password of the IUSR and IWAM local accounts on a machine?

After a late night session doing some work on a new webserver, I found a really important blog post (windowsitpro.com) for IIS administrators. The blog post shows how you get the password of the IUSR and the IWAM local accounts form the metabase.

Normally the IUSR and IWAM password are set automatically and unknown. But if you import the metabase on another you have to change the passwords of these two users (IUSR_<local machine name> and IWAM_<local machine name>).

  • First you have to update the adsutil.vbs script (localdiskdrive:\Inetpub\AdminScripts). You have to replace all the “”IsSecureProperty = True” with “”IsSecureProperty = False” otherwise the command would not show the real password.
  • Now you can run the following commands to get the password of these users

Get the IUSR password:

C:\Inetpub\AdminScripts>cscript adsutil.vbs get w3svc/anonymoususerpass

return:

anonymoususerpass : (STRING) "password"

Get the IWAM password:

C:\Inetpub\AdminScripts>cscript adsutil.vbs get w3svc/wamuserpass

return:

wamuserpass : (STRING) "password"

  • you also can set the passwords for those accounts in the metabase

Set the IUSR password:

C:\Inetpub\AdminScripts>cscript adsutil.vbs set w3svc/anonymoususerpass "password"

Set the IWAM password:

C:\Inetpub\AdminScripts>cscript adsutil.vbs set w3svc/wamuserpass "password"

  • after you change the passwords, you should sync the password from IIS with Microsoft Transaction Server (MTS) and component services with the following command

sync MTS:

C:\Inetpub\AdminScripts>cscript.exe synciwam.vbs -v

Thanks to John Savill