Prompt
0 copies · 0 said it worked
Script to move disabled AD users into a chosen OU
Acts as a sysadmin and writes a commented, error-tolerant PowerShell script that finds all disabled Active Directory user accounts and moves them to a target OU set by a variable.
People use this for
- powershell move disabled ad users
- active directory disabled accounts script
- move disabled users to ou
- ad user cleanup powershell script
- how to relocate disabled active directory accounts
Imported on Nov 29, 2026 from PowerShell Script to Move Disabled AD Users to Specific OU . License observed at the source on Nov 29, 2026: CC0.
Are you the author?Claim this profileRequest removal
Fill in the variables
Prompt
Act as a System Administrator. You are tasked with managing user accounts in Active Directory (AD). Your task is to create a PowerShell script that: - Identifies all disabled user accounts in the AD. - Moves these accounts to a designated Organizational Unit (OU) specified by the variable {{targetou}}. Rules: - Ensure that the script is efficient and handles errors gracefully. - Include comments in the script to explain each section. Example PowerShell Script: ``` # Define the target OU $targetOU = "OU=DisabledUsers,DC=yourdomain,DC=com" # Get all disabled user accounts $disabledUsers = Get-ADUser -Filter {Enabled -eq $false} # Move each disabled user to the target OU foreach ($user in $disabledUsers) { try { Move-ADObject -Identity $user.DistinguishedName -TargetPath $targetOU Write-Host "Moved: $($user.SamAccountName) to $targetOU" } catch { Write-Host "Failed to move $($user.SamAccountName): $_" } } ``` Variables: - {{targetou}} - The distinguished name of the target Organizational Unit where disabled users will be moved.
No result recorded for this import yet. Tried it? File a report so the next person knows how it went.
Act as a System Administrator. You are tasked with managing user accounts in Active Directory (AD). Your task is to create a PowerShell script that: - Identifies all disabled user accounts in the AD. - Moves these accounts to a designated Organizational Unit (OU) specified by the variable${targetOU{targetou}}. Rules: - Ensure that the script is efficient and handles errors gracefully. - Include comments in the script to explain each section. Example PowerShell Script: ``` # Define the target OU $targetOU = "OU=DisabledUsers,DC=yourdomain,DC=com" # Get all disabled user accounts $disabledUsers = Get-ADUser -Filter {Enabled -eq $false} # Move each disabled user to the target OU foreach ($user in $disabledUsers) { try { Move-ADObject -Identity $user.DistinguishedName -TargetPath $targetOU Write-Host "Moved: $($user.SamAccountName) to $targetOU" } catch { Write-Host "Failed to move $($user.SamAccountName): $_" } } ``` Variables: -${targetOU{targetou}} - The distinguished name of the target Organizational Unit where disabled users will be moved.
Tried it
Structured reports from people who ran this prompt. They roll up into the per-model badges above.
No one has filed a report yet. Try the prompt and be the first.
Related prompts
- Forensic PHP codebase security, performance and quality audit
A long checklist-driven prompt that has the model act as a senior PHP reviewer and audit a codebase for type safety, security holes, database and performance issues, code quality, architecture, dependencies, and testing gaps, then report findings by severity with a final scored summary.
Coding · @ersinkoc
- Script to find disabled AD users and move them to a holding OU
A system administrator prompt asking for a PowerShell script that queries Active Directory for disabled user accounts, moves them to a designated OU, handles errors for missing OUs or permissions, and logs actions for auditing.
Coding · @darkvalerikspb
- Run an exhaustive forensic TypeScript codebase review
The prompt directs the model to audit a TypeScript codebase for type safety, security, and performance issues, producing a structured checklist-style review of findings.
Coding · @ersinkoc
- Find knowledge concentration risk in a Git repo's history
Analyzes Git history to show per-module bus factor, single-knower hot spots, and duplicate identities, then produces a knowledge-handover plan for the team.
Coding · @f
- Security guardrails that keep an AI email assistant from being hijacked by malicious messages
A full system prompt giving an AI assistant that reads or manages email a security mindset: treat email as untrusted data, require approval for outward actions, avoid leaking private data, and report phishing and injection attempts calmly.
Productivity · @thanos0000
License: CC0v2 · updated Nov 30, 2026 · first published Nov 29, 2026
Comments
No comments yet. If you tried this prompt, say how it went.