This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.

Q. I want to run a PowerShell command and suppress any errors. What is the best way to do this? Dept - PowerShell

A. Within a PowerShell script you can set an error action to say always silently continue however the problem with this is that all errors are suppressed which may actually hide errors we want to see. Instead you can set an error action on specific commands using the -ErrorAction parameter, for example:

A. By default Active Directory has a policy that says a users password can only be changed once every 24 hours (Minimum password age). This is stop people just constantly changing their password back to a single password they use forever. Normally you set a flag that says for new users they must change their password on first logon which overrides this setting however for accounts replicated to Azure AD with the password this does not happen and people cannot change their password.

One solution is for the first logon and password change do this against a regular AD joined machine.

If this is not possible you can change the policy to 0 (which removes the 1 day wait) and then people can change their passwords straight away via the myapps.microsoft.com site.

To change the policy navigate to Computer Configuration - Policies - Windows Settings - Security Settings - Account Policies - Password Policy - Minimum password age then set to 0. You can also set Enforce password history so the last certain number of passwords are remembered so cannot be reused.