Link to home
Create AccountLog in
Avatar of GoPack
GoPack

asked on

PowerShell Active Directory call parameter not working

Hello,

Within PowerShell I’m setting the Default Domain Policy account settings, specifically the Maximum Password Age.  I’m trying to set it to 0, as in never expire.

From the TechNet site http://technet.microsoft.com/en-us/library/ee617251.aspx, the parameter types are time based.  I can’t figure out how to set it to 0 (not ‘0’ days as in the case of the MaxPasswordAge, which is a constant password change loop).  

I’m using the following PowerShell call:

$err = Set-ADDefaultDomainPasswordPolicy -Identity $DomainIdentity -MaxPasswordAge ??? -MinPasswordAge 1

Everything that makes sense (i.e. 0, 1, “0”, ‘0’, etc…) is a parameter error.  Although, you'll notice the MinPassWordAge works fine with 1.  I got 2 to work but sets the parameter to 0 days (emphasis on the days, it was a password change loop)  Does anyone know what parameter I need to send for just 0 –never expire?

Thanks
GoPack
ASKER CERTIFIED SOLUTION
Avatar of SubSun
SubSun
Flag of India image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of GoPack
GoPack

ASKER

Works perfect.  Thanks.
Avatar of GoPack

ASKER

Works perfect.