{"id":5221,"date":"2015-07-01T00:01:00","date_gmt":"2015-07-01T00:01:00","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2015\/07\/01\/use-windows-powershell-to-configure-domain-password-policy\/"},"modified":"2019-02-18T09:47:15","modified_gmt":"2019-02-18T16:47:15","slug":"use-windows-powershell-to-configure-domain-password-policy","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/use-windows-powershell-to-configure-domain-password-policy\/","title":{"rendered":"Use Windows PowerShell to Configure Domain Password Policy"},"content":{"rendered":"<p><b style=\"font-size:12px\">Summary<\/b><span style=\"font-size:12px\">: Ed Wilson, Microsoft Scripting Guy, talks about using Windows PowerShell to configure the default domain password policy.<\/span>\n<img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/q-for-powertip.jpg\" alt=\"Hey, Scripting Guy! Question\">&nbsp;Hey, Scripting Guy! I need some help. I need to get the default domain password policy, but I do not want to mess around with the Group Policy MMC. Instead, I would like to have objects I can use, and then make some decisions based on what I find. Can you help?\n&mdash;JB\n<img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/a-for-powertip.jpg\" alt=\"Hey, Scripting Guy! Answer\">&nbsp;Hello JB,\nMicrosoft Scripting Guy, Ed Wilson, is here. The good news is that the temperature today is only 80 degrees Fahrenheit. The bad news is that dew point is about 78, so the resultant relative humidity is about 92%. Oh well. It is wonderful weather for a nice cup of Darjeeling tea, a bit of local wildflower honey, and a slice of lemon. With some fresh locally grown mangos, I readily forget the high humidity. I have Stevie Ray Vaughn cranked up on my Zune, and I am checking the email sent to <a href=\"http:\/\/blogs.technet.commailto:scripter@microsoft.com\">scripter@microsoft.com<\/a>.\nJB, the good news for you is that the Active Directory module has all the tools you need to retrieve the default domain password policy, and even make changes to it.\nThe first thing to do is to retrieve the default domain password policy. Luckily, all you need to do is to find the appropriate Windows PowerShell cmdlet.<\/p>\n<p style=\"margin-left:30px\"><b>Note&nbsp;<\/b> If you do not have the Active Directory module installed on your local computer, you can access any remote computer that has it installed, and open a remote Windows PowerShell session.\nWhen I don&rsquo;t know a specific cmdlet name, I use the <b>Get-Command<\/b> cmdlet and search for it. To find my password cmdlets, I use the following command:<\/p>\n<p style=\"margin-left:30px\">PS C:&gt; gcm -Noun *password*<\/p>\n<p style=\"margin-left:30px\">CommandType &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Name &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ModuleName&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/p>\n<p style=\"margin-left:30px\">&#8212;&#8212;&#8212;&#8211; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#8212;- &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#8212;&#8212;&#8212;-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/p>\n<p style=\"margin-left:30px\">Cmdlet&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Add-ADDomainControllerPasswordReplicationPolicy&nbsp;&nbsp;&nbsp; activedirectory&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/p>\n<p style=\"margin-left:30px\">Cmdlet&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Add-ADFineGrainedPasswordPolicySubject&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; activedirectory&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/p>\n<p style=\"margin-left:30px\">Cmdlet&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Get-ADAccountResultantPasswordReplicationPolicy&nbsp;&nbsp;&nbsp; activedirectory&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/p>\n<p style=\"margin-left:30px\">Cmdlet&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Get-ADDefaultDomainPasswordPolicy&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; activedirectory&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/p>\n<p style=\"margin-left:30px\">Cmdlet&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Get-ADDomainControllerPasswordReplicationPolicy&nbsp;&nbsp;&nbsp; activedirectory&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/p>\n<p style=\"margin-left:30px\">Cmdlet&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Get-ADDomainControllerPasswordReplicationPolicy&#8230; activedirectory&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/p>\n<p style=\"margin-left:30px\">Cmdlet&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Get-ADFineGrainedPasswordPolicy&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; activedirectory&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/p>\n<p style=\"margin-left:30px\">Cmdlet&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Get-ADFineGrainedPasswordPolicySubject&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; activedirectory&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/p>\n<p style=\"margin-left:30px\">Cmdlet&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Get-ADUserResultantPasswordPolicy&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; activedirectory&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/p>\n<p style=\"margin-left:30px\">Cmdlet&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; New-ADFineGrainedPasswordPolicy&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; activedirectory&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/p>\n<p style=\"margin-left:30px\">Cmdlet&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Remove-ADDomainControllerPasswordReplicationPolicy activedirectory&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/p>\n<p style=\"margin-left:30px\">Cmdlet&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Remove-ADFineGrainedPasswordPolicy&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; activedirectory&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/p>\n<p style=\"margin-left:30px\">Cmdlet&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Remove-ADFineGrainedPasswordPolicySubject&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; activedirectory&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/p>\n<p style=\"margin-left:30px\">Cmdlet&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Reset-ADServiceAccountPassword&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; activedirectory&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/p>\n<p style=\"margin-left:30px\">Cmdlet&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;Reset-ComputerMachinePassword&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Microsoft.PowerShell&#8230;<\/p>\n<p style=\"margin-left:30px\">Cmdlet&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Set-ADAccountPassword&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; activedirectory&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/p>\n<p style=\"margin-left:30px\">Cmdlet&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Set-ADDefaultDomainPasswordPolicy&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; activedirectory&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/p>\n<p style=\"margin-left:30px\">Cmdlet&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Set-ADFineGrainedPasswordPolicy&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; activedirectory&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n<span style=\"font-size:12px\">It does not take too much imagination to find the cmdlet I need. It is the <\/span><b style=\"font-size:12px\">Get-ADDefaultDomainPasswordPolicy <\/b><span style=\"font-size:12px\">cmdlet. It works, by default, against my local domain. Here is the command and the results:<\/span><\/p>\n<p style=\"margin-left:30px\">PS C:&gt; Get-ADDefaultDomainPasswordPolicy<\/p>\n<p style=\"margin-left:30px\">ComplexityEnabled&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : False<\/p>\n<p style=\"margin-left:30px\">DistinguishedName&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : DC=NWTraders,DC=com<\/p>\n<p style=\"margin-left:30px\">LockoutDuration&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 00:15:00<\/p>\n<p style=\"margin-left:30px\">LockoutObservationWindow&nbsp;&nbsp;&nbsp; : 00:15:00<\/p>\n<p style=\"margin-left:30px\">LockoutThreshold&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 5<\/p>\n<p style=\"margin-left:30px\">MaxPasswordAge&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 00:00:00<\/p>\n<p style=\"margin-left:30px\">MinPasswordAge&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 00:00:00<\/p>\n<p style=\"margin-left:30px\">MinPasswordLength&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 1<\/p>\n<p style=\"margin-left:30px\">objectClass&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : {domainDNS}<\/p>\n<p style=\"margin-left:30px\">objectGuid&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : f8d7dfc5-37ef-4f0b-a106-c1de59439a58<\/p>\n<p style=\"margin-left:30px\">PasswordHistoryCount&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 0<\/p>\n<p style=\"margin-left:30px\">ReversibleEncryptionEnabled : False\nAs it turns out, there is some bad news&#8230;and some worse news. The bad news is that password complexity is not enabled. The worse news is that the minimum password length is 1. Can you say &#8220;double dude&#8221;!!\nLuckily, I can fix this.<\/p>\n<h2>Enable password complexity<\/h2>\n<p>As one might suspect, if the <b>Get-ADDefaultDomainPasswordPolicy<\/b> cmdlet retrieves the default domain password policy, the <b>Set-ADDefaultDomainPasswordPolicy<\/b> cmdlet configures it. But the <b>Get-ADDefaultDomainPasswordPolicy<\/b> cmdlet was very easy to use, and unfortunately, the <b>Set-ADDefaultDomainPasswordPolicy <\/b>cmdlet is finicky.\nFirst of all, I need to specify the domain to work with in the <b>&ndash;Identity<\/b> parameter. Because the <b>Get-ADDefaultDomainPasswordPolicy <\/b>cmdlet automatically retrieves the current domain doesn&rsquo;t mean that the <b>Set-ADDefaultDomainPasswordPolicy<\/b> cmdlet will automatically set the password policy on the current domain.\nIn addition, even though the <b>&ndash;ComplexityEnabled<\/b> parameter may look like it is a switched parameter, it is not. It accepts a Boolean value. Therefore, I need to supply <b>$true<\/b> or <b>$false<\/b> to it. Remember, this is not a switched parameter&mdash;it is a normal parameter that accepts a Boolean value as an argument. Here is the syntax to enable password complexity on the NWTraders.com domain:<\/p>\n<p style=\"margin-left:30px\">Set-ADDefaultDomainPasswordPolicy -ComplexityEnabled $true -Identity nwtraders.com\nNothing returns from this command, so I use the <b>Get-ADDefaultDomainPasswordPolicy<\/b> cmdlet to confirm the change. It immediately returns the following results:<\/p>\n<p style=\"margin-left:30px\">PS C:&gt; Get-ADDefaultDomainPasswordPolicy<\/p>\n<p style=\"margin-left:30px\"><span style=\"font-size:12px\">ComplexityEnabled&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : True<\/span><\/p>\n<p style=\"margin-left:30px\">DistinguishedName&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : DC=NWTraders,DC=com<\/p>\n<p style=\"margin-left:30px\">LockoutDuration&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 00:15:00<\/p>\n<p style=\"margin-left:30px\">LockoutObservationWindow&nbsp;&nbsp;&nbsp; : 00:15:00<\/p>\n<p style=\"margin-left:30px\">LockoutThreshold&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: 5<\/p>\n<p style=\"margin-left:30px\">MaxPasswordAge&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 00:00:00<\/p>\n<p style=\"margin-left:30px\">MinPasswordAge&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 00:00:00<\/p>\n<p style=\"margin-left:30px\">MinPasswordLength&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 1<\/p>\n<p style=\"margin-left:30px\">objectClass&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : {domainDNS}<\/p>\n<p style=\"margin-left:30px\">objectGuid&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : f8d7dfc5-37ef-4f0b-a106-c1de59439a58<\/p>\n<p style=\"margin-left:30px\">PasswordHistoryCount&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;: 0<\/p>\n<p style=\"margin-left:30px\">ReversibleEncryptionEnabled : False\n<span style=\"font-size:12px\">Cool. Now I need to set the minimum password length. Here is the command I use to do that:<\/span><\/p>\n<p style=\"margin-left:30px\">Set-ADDefaultDomainPasswordPolicy -MinPasswordLength 7 -Identity nwtraders.com\nOnce again, I check the output:<\/p>\n<p style=\"margin-left:30px\">PS C:&gt; Get-ADDefaultDomainPasswordPolicy<\/p>\n<p style=\"margin-left:30px\">ComplexityEnabled&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : True<\/p>\n<p style=\"margin-left:30px\">DistinguishedName&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : DC=NWTraders,DC=com<\/p>\n<p style=\"margin-left:30px\">LockoutDuration&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 00:15:00<\/p>\n<p style=\"margin-left:30px\">LockoutObservationWindow&nbsp;&nbsp;&nbsp; : 00:15:00<\/p>\n<p style=\"margin-left:30px\">LockoutThreshold&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 5<\/p>\n<p style=\"margin-left:30px\">MaxPasswordAge&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;: 00:00:00<\/p>\n<p style=\"margin-left:30px\">MinPasswordAge&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 00:00:00<\/p>\n<p style=\"margin-left:30px\">MinPasswordLength&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 7<\/p>\n<p style=\"margin-left:30px\">objectClass&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : {domainDNS}<\/p>\n<p style=\"margin-left:30px\">objectGuid&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : f8d7dfc5-37ef-4f0b-a106-c1de59439a58<\/p>\n<p style=\"margin-left:30px\">PasswordHistoryCount&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 0<\/p>\n<p style=\"margin-left:30px\">ReversibleEncryptionEnabled : False\nGro-oo-v-vy.\nOf course I can do all of this in a single command&mdash;and more. Here is an example of such a command (this is a single-line command that wraps in the blog format&mdash;no line breaks have been introduced).<\/p>\n<p style=\"margin-left:30px\">Set-ADDefaultDomainPasswordPolicy -Identity Nwtraders.com -ComplexityEnabled $true -MinPasswordLength 7 -MinPasswordAge 1 -MaxPasswordAge 30 -LockoutDuration 00:30:00 -LockoutObservationWindow 00:30:00 -LockoutThreshold 3\nAnd again, I can check my results:<\/p>\n<p style=\"margin-left:30px\">PS C:&gt; Get-ADDefaultDomainPasswordPolicy<\/p>\n<p style=\"margin-left:30px\">ComplexityEnabled&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : True<\/p>\n<p style=\"margin-left:30px\">DistinguishedName&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : DC=NWTraders,DC=com<\/p>\n<p style=\"margin-left:30px\">LockoutDuration&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 00:30:00<\/p>\n<p style=\"margin-left:30px\">LockoutObservationWindow&nbsp;&nbsp;&nbsp; : 00:30:00<\/p>\n<p style=\"margin-left:30px\">LockoutThreshold&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 3<\/p>\n<p style=\"margin-left:30px\">MaxPasswordAge&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 00:00:00.0000030<\/p>\n<p style=\"margin-left:30px\">MinPasswordAge&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 00:00:00.0000001<\/p>\n<p style=\"margin-left:30px\">MinPasswordLength&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 7<\/p>\n<p style=\"margin-left:30px\">objectClass&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : {domainDNS}<\/p>\n<p style=\"margin-left:30px\">objectGuid&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : f8d7dfc5-37ef-4f0b-a106-c1de59439a58<\/p>\n<p style=\"margin-left:30px\">PasswordHistoryCount&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 0<\/p>\n<p style=\"margin-left:30px\">ReversibleEncryptionEnabled : False\nJB, that is all there is to using Windows PowerShell to configure the default domain password policy. Active Directory Week will continue tomorrow when I will talk about more cool stuff.\nI invite you to follow me on <a href=\"http:\/\/bit.ly\/scriptingguystwitter\" target=\"_blank\">Twitter<\/a> and <a href=\"http:\/\/bit.ly\/scriptingguysfacebook\" target=\"_blank\">Facebook<\/a>. If you have any questions, send email to me at <a href=\"http:\/\/blogs.technet.commailto:scripter@microsoft.com\" target=\"_blank\">scripter@microsoft.com<\/a>, or post your questions on the <a href=\"http:\/\/bit.ly\/scriptingforum\" target=\"_blank\">Official Scripting Guys Forum<\/a>. See you tomorrow. Until then, peace.\n<b>Ed Wilson, Microsoft Scripting Guy<\/b><span style=\"font-size:12px\">&nbsp;<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Summary: Ed Wilson, Microsoft Scripting Guy, talks about using Windows PowerShell to configure the default domain password policy. &nbsp;Hey, Scripting Guy! I need some help. I need to get the default domain password policy, but I do not want to mess around with the Group Policy MMC. Instead, I would like to have objects I [&hellip;]<\/p>\n","protected":false},"author":596,"featured_media":87096,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-5221","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scripting"],"acf":[],"blog_post_summary":"<p>Summary: Ed Wilson, Microsoft Scripting Guy, talks about using Windows PowerShell to configure the default domain password policy. &nbsp;Hey, Scripting Guy! I need some help. I need to get the default domain password policy, but I do not want to mess around with the Group Policy MMC. Instead, I would like to have objects I [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/5221","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/users\/596"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/comments?post=5221"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/5221\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media\/87096"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media?parent=5221"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=5221"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=5221"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}