{"id":278,"date":"2014-11-26T11:59:00","date_gmt":"2014-11-26T11:59:00","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2014\/11\/26\/powertip-use-powershell-to-get-inactive-active-directory-accounts\/"},"modified":"2019-02-18T10:36:55","modified_gmt":"2019-02-18T17:36:55","slug":"powertip-use-powershell-to-get-inactive-active-directory-accounts","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/powertip-use-powershell-to-get-inactive-active-directory-accounts\/","title":{"rendered":"PowerTip: Use PowerShell to Get Inactive Active Directory Accounts"},"content":{"rendered":"<p><span style=\"font-size:12px\"><strong>Summary<\/strong>: U<span>se Windows PowerShell to get a report of inactive Active Directory accounts.<\/span><\/span><\/p>\n<p><span style=\"font-size:12px\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/q-for-powertip.jpg\" alt=\"Hey, Scripting Guy! Question\">How can I use Windows PowerShell to get a report of inactive Active Directory accounts?<\/span><\/p>\n<p style=\"margin-left:30px\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/a-for-powertip.jpg\" alt=\"Hey, Scripting Guy! Answer\">The&nbsp;<b>Search-ADAccount<\/b>&nbsp;cmdlet has a number of parameters and switches to help identify stale accounts:<\/p>\n<ul>\n<li style=\"list-style-type:none\">\n<ul>\n<li style=\"list-style-type:none\">\n<ul>\n<li>Search-ADAccount -AccountInactive<\/li>\n<li>Search-ADAccount -AccountDisabled<\/li>\n<li>Search-ADAccount -AccountExpired<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p style=\"margin-left:60px\">You can also use the&nbsp;<b>-UsersOnly<\/b>&nbsp;or&nbsp;<b>-ComputersOnly<\/b>&nbsp;switch to narrow the results:<\/p>\n<ul>\n<li style=\"list-style-type:none\">\n<ul>\n<li style=\"list-style-type:none\">\n<ul>\n<li>Search-ADAccount -AccountInactive -UsersOnly<\/li>\n<li>Search-ADAccount -AccountInactive &ndash;ComputersOnly<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Summary: Use Windows PowerShell to get a report of inactive Active Directory accounts. How can I use Windows PowerShell to get a report of inactive Active Directory accounts? The&nbsp;Search-ADAccount&nbsp;cmdlet has a number of parameters and switches to help identify stale accounts: Search-ADAccount -AccountInactive Search-ADAccount -AccountDisabled Search-ADAccount -AccountExpired You can also use the&nbsp;-UsersOnly&nbsp;or&nbsp;-ComputersOnly&nbsp;switch to narrow the [&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":[7,313,56,3,20,45],"class_list":["post-278","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scripting","tag-active-directory","tag-ashley-mcglone","tag-guest-blogger","tag-scripting-guy","tag-user-accounts","tag-windows-powershell"],"acf":[],"blog_post_summary":"<p>Summary: Use Windows PowerShell to get a report of inactive Active Directory accounts. How can I use Windows PowerShell to get a report of inactive Active Directory accounts? The&nbsp;Search-ADAccount&nbsp;cmdlet has a number of parameters and switches to help identify stale accounts: Search-ADAccount -AccountInactive Search-ADAccount -AccountDisabled Search-ADAccount -AccountExpired You can also use the&nbsp;-UsersOnly&nbsp;or&nbsp;-ComputersOnly&nbsp;switch to narrow the [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/278","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=278"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/278\/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=278"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=278"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=278"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}