{"id":3826,"date":"2024-06-26T13:22:00","date_gmt":"2024-06-26T13:22:00","guid":{"rendered":"https:\/\/www.systools.in\/blog\/?p=3826"},"modified":"2024-06-27T11:50:10","modified_gmt":"2024-06-27T11:50:10","slug":"unlock-ad-account-with-powershell-scripts","status":"publish","type":"post","link":"https:\/\/www.systools.in\/blog\/unlock-ad-account-with-powershell-scripts\/","title":{"rendered":"Unlock AD Account with PowerShell Scripts &#038; Reset Account Access"},"content":{"rendered":"<p>Whenever users face access denial issues, their first instinct is to ask the admin to unlock their AD account with PowerShell scripts. Although a user\u2019s job may end after raising a request, for the admin, this is just the start. They are the ones who have to sort out the confusing account status setup and filter out genuine locked users from the ones that have been disabled manually<br \/>\nThis task is quite challenging, especially for those admins who are not well-versed in PowerShell. Not to mention, even veteran administrators have expressed confusion regarding the status naming scheme that AD uses. So let\u2019s learn to distinguish between locked, inactive, disabled, deleted, and expired account types.<\/p>\n<div class=\"alert alert-warning\">\n<p><strong>Table of Contents<\/strong><\/p>\n<ul>\n<li><a href=\"#status\"><strong>AD Account Status<\/strong><\/a><\/li>\n<li><a href=\"#other\"><strong>Other Prerequisites<\/strong><\/a><\/li>\n<li><a href=\"#powershell\"><strong>Unlock AD Account with PowerShell<\/strong><\/a><\/li>\n<li><a href=\"#enmasse\"><strong>Unlock AD Account En Masse<\/strong><\/a><\/li>\n<li><a href=\"#list\"><strong>List Locked AD User Accounts<\/strong><\/a><\/li>\n<li><a href=\"#conclusion\"><strong>Conclusion<\/strong><\/a><\/li>\n<li><a href=\"#faq\"><strong>FAQs<\/strong><\/a><\/li>\n<\/ul>\n<\/div>\n<h2 id=\"status\">Before We Unlock AD Account with PowerShell Read This<\/h2>\n<p>Many times when admins want to unlock user accounts with PowerShell or otherwise, they often find it hard to keep track of the account. As many of the statuses sound similar but have different data retention and recovery polices. So to clear out the differences here is a tabular construction<\/p>\n<p>&nbsp;<\/p>\n<table class=\"table-bordered\" cellpadding=\"10\">\n<tbody>\n<tr>\n<td><b>Parameter<\/b><\/td>\n<td><b>Locked<\/b><\/td>\n<td><b>Inactive<\/b><\/td>\n<td><b>Disabled<\/b><\/td>\n<td><b>Deleted<\/b><\/td>\n<td><b>Expired<\/b><\/td>\n<\/tr>\n<tr>\n<td><b>Description<\/b><\/td>\n<td>The user account is temporarily inaccessible due to exceeding incorrect login attempts or administrator intervention.<\/td>\n<td>A user account remains active, but not in use for a period of time.<\/td>\n<td>Administrator(s) deliberately disable user account(s) to prevent login.<\/td>\n<td>The user account is permanently removed from Active Directory.<\/td>\n<td>The password associated with the account has reached its expiration date set by the administrator.<\/td>\n<\/tr>\n<tr>\n<td><b>Can Users\u00a0 Log In<\/b><\/td>\n<td>No<\/td>\n<td>Potentially (depending on the reason for inactivity)<\/td>\n<td>No<\/td>\n<td>N\/A<\/td>\n<td>No<\/td>\n<\/tr>\n<tr>\n<td><b>Requires Administrator Action<\/b><\/td>\n<td>Yes (to unlock)<\/td>\n<td>No<\/td>\n<td>Yes (to enable)<\/td>\n<td>Not Typically<\/td>\n<td>No (password reset might be needed)<\/td>\n<\/tr>\n<tr>\n<td><b>Account Still Exists in AD<\/b><\/td>\n<td>Yes<\/td>\n<td>Yes<\/td>\n<td>Yes\/No (Organization Rules)<\/td>\n<td>No<\/td>\n<td>Yes (until purged)<\/td>\n<\/tr>\n<tr>\n<td><b>Data Wiped Out<\/b><\/td>\n<td>No<\/td>\n<td>Policy Dependent<\/td>\n<td>No<\/td>\n<td>Yes<\/td>\n<td>No<\/td>\n<\/tr>\n<tr>\n<td><b>Typically Caused by<\/b><\/td>\n<td>&#8211; Repeated failed login attempts. &#8211; Security measure by administrator.<\/td>\n<td>&#8211; User on leave or long-term absence. &#8211; Seasonal employees.<\/td>\n<td>&#8211; Terminated employee. &#8211; Contractor access revoked.<\/td>\n<td>&#8211; Removing unused accounts for security and efficiency.<\/td>\n<td>&#8211; Enforcing password changes at regular intervals.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p>Now we hope admins have no problem figuring out when to <a href=\"https:\/\/www.systools.in\/blog\/find-inactive-computers-in-active-directory\/\" target=\"_blank\" rel=\"noopener\">find inactive computers in Active Directory<\/a> from other requirements like unlocking. So let\u2019s see what preparation one has to make before regaining account access.<\/p>\n<h2 id=\"other\">Prerequisites to Unlock AD Accounts with PowerShell Scripts<\/h2>\n<p>Locked Account recovery is one of the high-priority tasks that administrators need to complete at once. The alternative is losing countless user productivity hours. No organization can afford to fall behind due to a trivial problem like being locked out.<\/p>\n<p>Moreover, having a regular reporting mechanism can help administrators understand which users are more prone to getting their accounts locked out.<br \/>\nHere is a small list of prerequisites that need to be completed before you can go forward with the regular task.<\/p>\n<ul>\n<li>First is using the RSAT make sure that you have the Active Directory Module installed and running.<\/li>\n<li>Second, check that PowerShell is updated to the latest version supported by your Windows desktop or Server OS.<\/li>\n<\/ul>\n<h3 id=\"powershell\">How to Unlock AD Account with PowerShell Quickly<\/h3>\n<p>Open a new PowerShell module and type:<\/p>\n<pre>Get-ADUser -Filter * -Properties LockedOut | Where-Object { $_.LockedOut -eq $true }<\/pre>\n<p>This displays all those accounts that are locked. Don\u2019t worry if you can&#8217;t see an output or notification right away. It just means that in the current domain, all users have access to the accounts. so change the domain open a new PowerShell module and use the same cmdlet.<\/p>\n<p>Copy the distinguished name and\u00a0 paste it alongside the following command to change the lockout status:<\/p>\n<pre>Unlock-ADAccount -Identity \"CN=Dummy DU22. User22,OU=New Users,DC=cu14mail,DC=local\"<\/pre>\n<p>Ensure that you type the user name correctly or you may get an error or invalid results. Reuse the first cmdlet to verify the change.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-4081\" src=\"https:\/\/www.systools.in\/blog\/wp-content\/uploads\/2024\/05\/powershell-cmdlet.webp\" alt=\"PowerShell cmdlet \" width=\"859\" height=\"331\" \/><\/p>\n<p>Sometimes administrators may be in a situation where a mass lockout has happened. In such a case, it is not wise to unlock each account one by one. A better way would be to deploy an AD-wide script that resets account access all at once.<\/p>\n<h3 id=\"enmasse\">PowerShell Scripts to Unlock AD Accounts in Bulk<\/h3>\n<pre>Search-ADAccount -LockedOut -UsersOnly | Unlock-ADAccount -Confirm<\/pre>\n<p>The above cmdlet combines the search filter with the unlock operation by restricting the scope to all locked accounts. Moreover, by adding the confirm parameter, you can trigger an individual level of yes or no criteria. If you know that the locked accounts are few and were due to some erroneous result, you can omit the &#8220;-Confirm&#8221; parameter from the cmdlet altogether.<\/p>\n<p>The problem with this cmdlet is that admins have to type it out every time manually. To automate account unlocking, we take help from an in-built Microsoft utility, i.e., the Task Scheduler application.<\/p>\n<p>First, we are going to make a custom script that unlocks the user account:<\/p>\n<pre># Import the ActiveDirectory module\r\nImport-Module ActiveDirectory\r\n\r\n# Function to unlock locked user accounts\r\nfunction Unlock-LockedAccounts {\r\n# Get all locked user accounts\r\n$lockedAccounts = Search-ADAccount -LockedOut -UsersOnly\r\n\r\nif ($lockedAccounts.Count -eq 0) {\r\nWrite-Output \"No locked user accounts found.\"\r\nreturn\r\n}\r\n\r\n# Loop through each locked account and unlock it\r\nforeach ($account in $lockedAccounts) {\r\ntry {\r\nUnlock-ADAccount -Identity $account\r\nWrite-Output \"Unlocked account: $($account.SamAccountName)\"\r\n} catch {\r\nWrite-Output \"Failed to unlock account: $($account.SamAccountName). Error: $_\"\r\n}\r\n}\r\n}\r\n\r\n# Call the function to unlock locked accounts\r\nUnlock-LockedAccounts<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-4080\" src=\"https:\/\/www.systools.in\/blog\/wp-content\/uploads\/2024\/05\/powershell-script.webp\" alt=\"Unlock AD Account With PowerShell\" width=\"662\" height=\"628\" \/><\/p>\n<p>Next, use a different set of PowerShell commands to create a scheduled task that starts running the first script without admin intervention.<\/p>\n<pre># Path to the script to be scheduled\r\n$scriptPath = \"C:\\Users\\Administrator\\Documents\\UnlockAccounts.ps1\"\r\n\r\n# Task name\r\n$taskName = \"UnlockADAccounts\"\r\n\r\n# Task action\r\n$action = New-ScheduledTaskAction -Execute \"PowerShell.exe\" -Argument \"-NoProfile -ExecutionPolicy Bypass -File `\"$scriptPath`\"\"\r\n\r\n# Task trigger (every 15 minutes)\r\n$trigger = New-ScheduledTaskTrigger -Once -At (Get-Date).DateTime -RepetitionInterval (New-TimeSpan -Minutes 1)\r\n# Task settings\r\n$settings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries -StartWhenAvailable -DontStopOnIdleEnd -RestartCount 3 -RestartInterval (New-TimeSpan -Minutes 1)\r\n\r\n# Register the scheduled task\r\nRegister-ScheduledTask -Action $action -Trigger $trigger -Settings $settings -TaskName $taskName -Description \"Unlock locked Active Directory user accounts every minute\"\r\n\r\nWrite-Output \"Scheduled task '$taskName' created to run '$scriptPath' every minute.\"<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-4082\" src=\"https:\/\/www.systools.in\/blog\/wp-content\/uploads\/2024\/05\/auto-unlock.webp\" alt=\"Schedule Auto Unlocking\" width=\"718\" height=\"628\" \/><\/p>\n<p>Moreover, it is always best practice to <a href=\"https:\/\/www.systools.in\/blog\/reset-user-password-in-active-directory\/\">reset user passwords in Active Directory<\/a> after a bulk unlocking event. Create a new password policy and add all frequent lockout users to that policy. Using PowerShell to unlock accounts is fine but the administrator can&#8217;t rely on the scripts for a simple check. More often than not, administrators need to keep a record of lockouts in CSV format.<\/p>\n<p>This PowerShell script is currently missing that feature so admins have to rely on their own wit to add that capability. However, as the PowerShell script is already too complex, it may lead to unintended consequences. So for all reporting purposes, admins can rely on a tried-and-tested utility instead.<\/p>\n<h3 id=\"list\">Automated Solution to List Locked AD User Accounts<\/h3>\n<p>The <b>SysTools Active Directory Reporting Software<\/b> comes with advanced filtering options to pick and pull the locked account from the rest of the users. It shows the time and arranges the accounts depending on their lockout duration.<\/p>\n<p>Moreover, you always have the option to verify the lock unlock change with the help of the tool described earlier. This is because all AD updates happen in real-time; therefore, the tool automatically replicates the latest change and shows you the results accordingly.<\/p>\n<p>When these smart grouping options combine with the easy-to-navigate UI, any admin can list the data in record time.<\/p>\n<p class=\"text-center mr-2\"><a class=\"btn btn-lg btn-md-block text-white\" style=\"background: #28a745; color: #fff !important;\" href=\"https:\/\/systoolskart.com\/download\/SYS4A2D6R\/29\" rel=\"nofollow\"> Download Now<\/a> <a class=\"btn btn-lg btn-md-block text-white\" style=\"background: #ff6800; color: #fff !important;\" href=\"https:\/\/systoolskart.com\/buy\/SYS4A2D6R\/29\" target=\"_blank\" rel=\"noopener noreferrer nofollow\">Purchase Now<\/a><\/p>\n<p>As a result, admins should have no trouble getting familiar with the tool. For any doubts, we have the tutorial arranged for you as well.<\/p>\n<ul>\n<li>Open the tool with the auto-filled credentials (administrator).<br \/>\n<img decoding=\"async\" src=\"https:\/\/systoolskart.com\/imgp\/ad-reporter\/step-1.webp\" alt=\"Type administrator\" \/><\/li>\n<li>Hit the REGISTER DOMAIN CONTROLLER button.<br \/>\n<img decoding=\"async\" src=\"https:\/\/systoolskart.com\/imgp\/ad-reporter\/step-6.webp\" alt=\"Register Domain Controller button\" \/><\/li>\n<li>Fill in your Domain friendly name and the correct IP address in the space provided. Then hit the save and continue button.<br \/>\n<img decoding=\"async\" src=\"https:\/\/systoolskart.com\/imgp\/ad-reporter\/step-8.webp\" alt=\"browse-pdf-file\" \/><\/li>\n<li>The domain details page is where you have to fill in the admin-level credentials, i.e. the email ID and password.<br \/>\n<img decoding=\"async\" src=\"https:\/\/systoolskart.com\/imgp\/ad-reporter\/step-9-5.webp\" alt=\"Save Credentials\" \/><\/li>\n<li>After that, move to the Report page and select the Locked category under the user workload.<br \/>\n<img decoding=\"async\" src=\"https:\/\/systoolskart.com\/imgp\/ad-reporter\/step-12.webp\" alt=\"User\" \/><\/li>\n<li>If you want you can set the duration by choosing any one of the six different time spans allocated in the duration dropdown. Otherwise, if you want there is a custom filter too.<br \/>\n<img decoding=\"async\" src=\"https:\/\/systoolskart.com\/imgp\/ad-reporter\/step-12-6.webp\" alt=\"preset time intervals\" \/><\/li>\n<li>Press the preview button to see for which accounts you have to use PowerShell commands to unlock accessibility.<br \/>\n<img decoding=\"async\" src=\"https:\/\/systoolskart.com\/imgp\/ad-reporter\/ad-reporter-preview-options.gif\" alt=\"Preview\" \/><\/li>\n<li>Hit Download and Select CSV to get the list<br \/>\n<img decoding=\"async\" src=\"https:\/\/systoolskart.com\/imgp\/ad-reporter\/ad-reporter-download-csv-report.gif\" alt=\"Download CSV\" \/><\/li>\n<\/ul>\n<h3 id=\"conclusion\">Conclusion<\/h3>\n<p>Every admin looking for a way to unlock found their answer in this blog. It doesn&#8217;t matter if administrators want to give access back to one account or multiple accounts; the solutions discussed here work for every scenario. Moreover, before unlocking admins should have Apart from the scripts, we gave the tools to identify locked accounts and also explained the distinction between the different account statuses.<\/p>\n<h4 id=\"faq\">Frequently Asked Questions<\/h4>\n<p><strong>Q. What is the PowerShell cmdlet that can Unlock a User Account?<\/strong><br \/>\nThere is a simple cmdlet called Unlock-ADAccount. Along with it type the user name (or other object-identifying property like DN).<\/p>\n<p><strong>Q. Some users get locked out of their accounts repeatedly how can I automate the unlocking process?<\/strong><br \/>\nYou can use Task Scheduler (Register-ScheduledTask cmdlet) alongside the usual PowerShell and make a self-unlocking script. Not that depending on the settings Admin workstation must be online for the script to work.<\/p>\n<p><strong>Q. Are there any precautions that I as an admin need to take when I set an auto-unlock task?<\/strong><\/p>\n<p>Yes, there is a list of practices that need to be followed:<\/p>\n<ul>\n<li>First, endure security. Unlocking accounts indiscriminately can be a security risk. So use filters to only unlock those accounts that have a genuine user request.<\/li>\n<li>Keep the frequency with which account lockout checks occur in balance. Having checks that are too close or too far apart may be detrimental.<\/li>\n<li>Add your own custom error-handling scenarios to the PowerShell script.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Whenever users face access denial issues, their first instinct is to ask the admin to unlock their AD account with PowerShell scripts. Although a user\u2019s job may end after raising <\/p>\n","protected":false},"author":7,"featured_media":3827,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[361],"class_list":["post-3826","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-active-directory"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Unlock AD Account with PowerShell Code &amp; Reset User Access<\/title>\n<meta name=\"description\" content=\"Learn to unlock AD account with PowerShell commands and prepare a list of all users who are unable to access their Active Directory account.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.systools.in\/blog\/unlock-ad-account-with-powershell-scripts\/\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"siddharth\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.systools.in\\\/blog\\\/unlock-ad-account-with-powershell-scripts\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.systools.in\\\/blog\\\/unlock-ad-account-with-powershell-scripts\\\/\"},\"author\":{\"name\":\"siddharth\",\"@id\":\"https:\\\/\\\/www.systools.in\\\/blog\\\/#\\\/schema\\\/person\\\/a719240fe0eff759b37c012b65b0f138\"},\"headline\":\"Unlock AD Account with PowerShell Scripts &#038; Reset Account Access\",\"datePublished\":\"2024-06-26T13:22:00+00:00\",\"dateModified\":\"2024-06-27T11:50:10+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.systools.in\\\/blog\\\/unlock-ad-account-with-powershell-scripts\\\/\"},\"wordCount\":1465,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/www.systools.in\\\/blog\\\/unlock-ad-account-with-powershell-scripts\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.systools.in\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/05\\\/unlock-ad-users-with-powershell.png\",\"articleSection\":[\"Active Directory\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.systools.in\\\/blog\\\/unlock-ad-account-with-powershell-scripts\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.systools.in\\\/blog\\\/unlock-ad-account-with-powershell-scripts\\\/\",\"url\":\"https:\\\/\\\/www.systools.in\\\/blog\\\/unlock-ad-account-with-powershell-scripts\\\/\",\"name\":\"Unlock AD Account with PowerShell Code & Reset User Access\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.systools.in\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.systools.in\\\/blog\\\/unlock-ad-account-with-powershell-scripts\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.systools.in\\\/blog\\\/unlock-ad-account-with-powershell-scripts\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.systools.in\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/05\\\/unlock-ad-users-with-powershell.png\",\"datePublished\":\"2024-06-26T13:22:00+00:00\",\"dateModified\":\"2024-06-27T11:50:10+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.systools.in\\\/blog\\\/#\\\/schema\\\/person\\\/a719240fe0eff759b37c012b65b0f138\"},\"description\":\"Learn to unlock AD account with PowerShell commands and prepare a list of all users who are unable to access their Active Directory account.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.systools.in\\\/blog\\\/unlock-ad-account-with-powershell-scripts\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.systools.in\\\/blog\\\/unlock-ad-account-with-powershell-scripts\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.systools.in\\\/blog\\\/unlock-ad-account-with-powershell-scripts\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.systools.in\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/05\\\/unlock-ad-users-with-powershell.png\",\"contentUrl\":\"https:\\\/\\\/www.systools.in\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/05\\\/unlock-ad-users-with-powershell.png\",\"width\":640,\"height\":360,\"caption\":\"Unlock AD Account with PowerShell\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.systools.in\\\/blog\\\/unlock-ad-account-with-powershell-scripts\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.systools.in\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Unlock AD Account with PowerShell Scripts &#038; Reset Account Access\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.systools.in\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.systools.in\\\/blog\\\/\",\"name\":\"Informative Blogs Related To Technologies &amp; Data Recovery Solutions\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.systools.in\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.systools.in\\\/blog\\\/#\\\/schema\\\/person\\\/a719240fe0eff759b37c012b65b0f138\",\"name\":\"siddharth\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/36008fc382c078c0181bbc3f19fd908ee42a71cf3d336b9b2864d3ba99da3786?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/36008fc382c078c0181bbc3f19fd908ee42a71cf3d336b9b2864d3ba99da3786?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/36008fc382c078c0181bbc3f19fd908ee42a71cf3d336b9b2864d3ba99da3786?s=96&d=mm&r=g\",\"caption\":\"siddharth\"},\"description\":\"With years experience in Data Recovery field, I am well aware of the technicalities faced by the user while working on various technologies and applications. I love to sharing technical data through my blogs and articles regarding the technology.\",\"url\":\"https:\\\/\\\/www.systools.in\\\/blog\\\/author\\\/siddharth\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Unlock AD Account with PowerShell Code & Reset User Access","description":"Learn to unlock AD account with PowerShell commands and prepare a list of all users who are unable to access their Active Directory account.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.systools.in\/blog\/unlock-ad-account-with-powershell-scripts\/","twitter_misc":{"Written by":"siddharth","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.systools.in\/blog\/unlock-ad-account-with-powershell-scripts\/#article","isPartOf":{"@id":"https:\/\/www.systools.in\/blog\/unlock-ad-account-with-powershell-scripts\/"},"author":{"name":"siddharth","@id":"https:\/\/www.systools.in\/blog\/#\/schema\/person\/a719240fe0eff759b37c012b65b0f138"},"headline":"Unlock AD Account with PowerShell Scripts &#038; Reset Account Access","datePublished":"2024-06-26T13:22:00+00:00","dateModified":"2024-06-27T11:50:10+00:00","mainEntityOfPage":{"@id":"https:\/\/www.systools.in\/blog\/unlock-ad-account-with-powershell-scripts\/"},"wordCount":1465,"commentCount":0,"image":{"@id":"https:\/\/www.systools.in\/blog\/unlock-ad-account-with-powershell-scripts\/#primaryimage"},"thumbnailUrl":"https:\/\/www.systools.in\/blog\/wp-content\/uploads\/2024\/05\/unlock-ad-users-with-powershell.png","articleSection":["Active Directory"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.systools.in\/blog\/unlock-ad-account-with-powershell-scripts\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.systools.in\/blog\/unlock-ad-account-with-powershell-scripts\/","url":"https:\/\/www.systools.in\/blog\/unlock-ad-account-with-powershell-scripts\/","name":"Unlock AD Account with PowerShell Code & Reset User Access","isPartOf":{"@id":"https:\/\/www.systools.in\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.systools.in\/blog\/unlock-ad-account-with-powershell-scripts\/#primaryimage"},"image":{"@id":"https:\/\/www.systools.in\/blog\/unlock-ad-account-with-powershell-scripts\/#primaryimage"},"thumbnailUrl":"https:\/\/www.systools.in\/blog\/wp-content\/uploads\/2024\/05\/unlock-ad-users-with-powershell.png","datePublished":"2024-06-26T13:22:00+00:00","dateModified":"2024-06-27T11:50:10+00:00","author":{"@id":"https:\/\/www.systools.in\/blog\/#\/schema\/person\/a719240fe0eff759b37c012b65b0f138"},"description":"Learn to unlock AD account with PowerShell commands and prepare a list of all users who are unable to access their Active Directory account.","breadcrumb":{"@id":"https:\/\/www.systools.in\/blog\/unlock-ad-account-with-powershell-scripts\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.systools.in\/blog\/unlock-ad-account-with-powershell-scripts\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.systools.in\/blog\/unlock-ad-account-with-powershell-scripts\/#primaryimage","url":"https:\/\/www.systools.in\/blog\/wp-content\/uploads\/2024\/05\/unlock-ad-users-with-powershell.png","contentUrl":"https:\/\/www.systools.in\/blog\/wp-content\/uploads\/2024\/05\/unlock-ad-users-with-powershell.png","width":640,"height":360,"caption":"Unlock AD Account with PowerShell"},{"@type":"BreadcrumbList","@id":"https:\/\/www.systools.in\/blog\/unlock-ad-account-with-powershell-scripts\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.systools.in\/blog\/"},{"@type":"ListItem","position":2,"name":"Unlock AD Account with PowerShell Scripts &#038; Reset Account Access"}]},{"@type":"WebSite","@id":"https:\/\/www.systools.in\/blog\/#website","url":"https:\/\/www.systools.in\/blog\/","name":"Informative Blogs Related To Technologies &amp; Data Recovery Solutions","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.systools.in\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.systools.in\/blog\/#\/schema\/person\/a719240fe0eff759b37c012b65b0f138","name":"siddharth","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/36008fc382c078c0181bbc3f19fd908ee42a71cf3d336b9b2864d3ba99da3786?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/36008fc382c078c0181bbc3f19fd908ee42a71cf3d336b9b2864d3ba99da3786?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/36008fc382c078c0181bbc3f19fd908ee42a71cf3d336b9b2864d3ba99da3786?s=96&d=mm&r=g","caption":"siddharth"},"description":"With years experience in Data Recovery field, I am well aware of the technicalities faced by the user while working on various technologies and applications. I love to sharing technical data through my blogs and articles regarding the technology.","url":"https:\/\/www.systools.in\/blog\/author\/siddharth\/"}]}},"_links":{"self":[{"href":"https:\/\/www.systools.in\/blog\/wp-json\/wp\/v2\/posts\/3826","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.systools.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.systools.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.systools.in\/blog\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/www.systools.in\/blog\/wp-json\/wp\/v2\/comments?post=3826"}],"version-history":[{"count":0,"href":"https:\/\/www.systools.in\/blog\/wp-json\/wp\/v2\/posts\/3826\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.systools.in\/blog\/wp-json\/wp\/v2\/media\/3827"}],"wp:attachment":[{"href":"https:\/\/www.systools.in\/blog\/wp-json\/wp\/v2\/media?parent=3826"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.systools.in\/blog\/wp-json\/wp\/v2\/categories?post=3826"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}