Prompt to Prompt: PowerShell Script for Disabled AD Users
Prompt to Prompt: PowerShell Script for Disabled AD Users is a verified PROMPT blueprint on Promptally in System & Base Contexts optimized for leading AI models. Curated Coding prompt from awesome-prompts library split. Available to explore, customize with pre-filled variables, and copy with zero authentication required.
Technical Specifications
| Specification | Value |
|---|---|
| Artifact type | PROMPT (System & Base Contexts) |
| Compatible engines | Universal / Model Agnostic |
| Input variables | None (pre-filled) |
| Approximate tokens | 262 |
| Source file | prompt-prompt-powershell-script-for-disabled-ad-users.txt |
| Access tier | Free public (MIT) |
Pre-Filled Template
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): $_"
}
}
```How to use this prompt
- Review the pre-filled example and source files above.
- Copy the template or download
prompt-prompt-powershell-script-for-disabled-ad-users.txt, then use it in your model, IDE, or workflow tool. - Compare your result with the sample output when one is provided.
Frequently Asked Questions
How do I use Prompt to Prompt: PowerShell Script for Disabled AD Users?
Open the prompt on Promptally, review the pre-filled example, then copy the template or download prompt-prompt-powershell-script-for-disabled-ad-users.txt and paste it into your model, IDE or workflow tool. Prompt to Prompt: PowerShell Script for Disabled AD Users is a static blueprint with no dynamic variables. Copy it and use it as-is.
Is Prompt to Prompt: PowerShell Script for Disabled AD Users free?
Yes. Prompt to Prompt: PowerShell Script for Disabled AD Users is free to view, copy and download on Promptally without creating an account. It is published under the MIT license.
What variables does Prompt to Prompt: PowerShell Script for Disabled AD Users need?
Prompt to Prompt: PowerShell Script for Disabled AD Users is a static blueprint with no dynamic variables. Copy it and use it as-is.