Перейти к содержанию

Active Directory Users And | Computer

catch Write-Error "Failed on $($user.SAMAccountName): $_"

Here’s a structured plan to build a for managing Active Directory Users and Computers , whether you're enhancing an existing tool, building a new one, or integrating AD management into an application. active directory users and computer

# Bulk unlock users from CSV (SAMAccountName list) $users = Import-Csv "locked_users.csv" foreach ($user in $users) try $adUser = Get-ADUser -Identity $user.SAMAccountName -Properties LockedOut if ($adUser.LockedOut) Unlock-ADAccount -Identity $adUser Write-Host "Unlocked: $($adUser.SAMAccountName)" -ForegroundColor Green else Write-Warning "$($adUser.SAMAccountName) is not locked" catch Write-Error "Failed on $($user

×
×
  • Создать...

Важная информация

Правила пользования сайтом Условия использования