ipIterPrompt

PowerShell Script for Managing Disabled AD Users

Turn any AI chat into a powershell script for managing disabled ad users with this community persona prompt.

dark.valerik.spb@gmail.com · awesome-chatgpt-promptsUpdated 2026-06-033,533 copies

PowerShell Script for Managing Disabled AD Users is a community-contributed prompt from awesome-chatgpt-prompts (CC0). Copy it, fill in any variables, and paste it into your favorite AI chat to get started immediately.

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

Run this prompt on a real model without leaving the page. Every run is saved to your history for this prompt.

How to use

  1. 1Copy the prompt as-is — no variables required.
  2. 2Paste it into ChatGPT, Claude, Gemini, or any capable model.
  3. 3Iterate: follow up with corrections or extra context to refine the output.

Related

PowerShell Script to Move Disabled AD Users to Specific OU

Turn any AI chat into a powershell script to move disabled ad users to specific ou with this community persona prompt.

2,940 copiesOpen ↗

Prompt Generator

Turn any AI chat into a prompt generator with this community persona prompt.

2,197 copiesOpen ↗

Proofreader

Turn any AI chat into a proofreader with this community persona prompt.

4,584 copiesOpen ↗

Integrity & Compliance Officer Audit Protocol

Turn any AI chat into an integrity & compliance officer audit protocol with this community persona prompt.

4,522 copiesOpen ↗