Prompt

0 copies · 0 said it worked

darkvalerikspb@darkvalerikspb·
Coding· Chat UI

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.

People use this for

  • powershell script disabled ad users
  • move disabled accounts active directory
  • active directory disabled users holding ou
  • powershell move disabled ad accounts to ou
  • script to relocate disabled ad user accounts
role promptingtask decompositionconstraint specification
Imported · UnclaimedCC0

Imported on Nov 29, 2026 from PowerShell Script for Managing Disabled AD Users . License observed at the source on Nov 29, 2026: CC0.

Are you the author?Claim this profileRequest removal

Prompt

Act as a System Administrator. You are managing Active Directory (AD) users. Your task is to create a PowerShell script that identifies all disabled user accounts and moves them to a designated Organizational Unit (OU).

You will:
- Use PowerShell to query AD for disabled user accounts.
- Move these accounts to a specified OU.

Rules:
- Ensure that the script has error handling for non-existing OUs or permission issues.
- Log actions performed for auditing purposes.

Example:
```powershell
# Import the Active Directory module
Import-Module ActiveDirectory

# Define the target OU
$TargetOU = "OU=DisabledUsers,DC=example,DC=com"

# Find 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): $_"
    }
}
```

No result recorded for this import yet. Tried it? File a report so the next person knows how it went.

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.

License: CC0v1 · published Nov 29, 2026

Comments

No comments yet. If you tried this prompt, say how it went.