{"id":106,"date":"2018-09-07T11:05:17","date_gmt":"2018-09-07T15:05:17","guid":{"rendered":"http:\/\/www.thelamberts.com\/wiki\/?p=106"},"modified":"2018-09-10T07:54:58","modified_gmt":"2018-09-10T11:54:58","slug":"disable-expire-and-reset-password-of-ad-account","status":"publish","type":"post","link":"http:\/\/www.thelamberts.com\/wiki\/2018\/09\/07\/disable-expire-and-reset-password-of-ad-account\/","title":{"rendered":"Disable, expire and reset password of AD account"},"content":{"rendered":"<pre class=\"brush: powershell; title: ; notranslate\" title=\"\"># Setting the parameters \r\nParam (\r\n&#x5B;Parameter(Mandatory=$true)]\r\n&#x5B;string]$Username\r\n)\r\n\r\n#\r\n# Import the tools to work with AD.\r\n#\r\nImport-Module ActiveDirectory\r\n\r\n#\r\n# Disabled, exprire then reset password the account\r\n#\r\nDisable-ADAccount -Identity $Username\r\nSet-ADAccountExpiration -Identity $Username -DateTime &quot;11\/12\/2011&quot;\r\nSet-ADAccountPassword -Identity $Username -Reset -NewPassword (ConvertTo-SecureString -AsPlainText &quot;newpassword&quot; -Force)<\/pre>","protected":false},"excerpt":{"rendered":"# Setting the parameters Param ( &#x5B;Parameter(Mandatory=$true)] &#x5B;string]$Username ) # # Import the tools to work with AD. # Import-Module ActiveDirectory # # Disabled, exprire then reset password the account # Disable-ADAccount -Identity $Username Set-ADAccountExpiration -Identity $Username -DateTime &quot;11\/12\/2011&quot; Set-ADAccountPassword -Identity $Username -Reset -NewPassword (ConvertTo-SecureString -AsPlainText &quot;newpassword&quot; -Force)","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23,3],"tags":[],"class_list":["post-106","post","type-post","status-publish","format-standard","hentry","category-active-directory","category-powershell"],"_links":{"self":[{"href":"http:\/\/www.thelamberts.com\/wiki\/wp-json\/wp\/v2\/posts\/106","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.thelamberts.com\/wiki\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.thelamberts.com\/wiki\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.thelamberts.com\/wiki\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.thelamberts.com\/wiki\/wp-json\/wp\/v2\/comments?post=106"}],"version-history":[{"count":5,"href":"http:\/\/www.thelamberts.com\/wiki\/wp-json\/wp\/v2\/posts\/106\/revisions"}],"predecessor-version":[{"id":116,"href":"http:\/\/www.thelamberts.com\/wiki\/wp-json\/wp\/v2\/posts\/106\/revisions\/116"}],"wp:attachment":[{"href":"http:\/\/www.thelamberts.com\/wiki\/wp-json\/wp\/v2\/media?parent=106"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.thelamberts.com\/wiki\/wp-json\/wp\/v2\/categories?post=106"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.thelamberts.com\/wiki\/wp-json\/wp\/v2\/tags?post=106"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}