English
☰ 분류

AD 비활성 계정 이동 프롬프트

targetOU를 넣으면 Active Directory의 비활성 사용자 계정을 조회해 지정된 조직 단위로 이동하는 주석 포함 PowerShell 스크립트를 만듭니다.

분류개발 › 배포·운영
태그초안작성개발자코드
프롬프트 (영어 본문 · 답은 한국어로 옵니다)
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.

어떤 프롬프트인가

비활성 AD 사용자를 특정 OU로 옮기는 스크립트 초안을 만들 때 쓰기 좋다. 효율성과 오류 처리를 요구하며, 각 섹션에 주석을 포함하도록 한다.

같은 분류의 프롬프트

프로덕션 AI 에이전트 설계 프롬프트
AI 에이전트 보안 점검 프롬프트
AI 제공자 요금 조사 프롬프트
상자 탈출 AI 역할을 맡기는 프롬프트
보안 경고 분석 프롬프트