도메인 컴퓨터 계정은 언제 암호를 변경하도록 예약되어 있나요?

도메인 컴퓨터 계정은 언제 암호를 변경하도록 예약되어 있나요?

도메인에 가입된 컴퓨터에는 AD에 컴퓨터 계정이 있고 이러한 계정에는 만료되는 비밀번호가 있으며(기본적으로 30일마다) 해당 비밀번호는 사용자 개입 없이 자동으로 변경된다는 것을 알고 있습니다.

이것이 도메인에 가입된 가상 컴퓨터의 스냅샷을 복원할 때 문제를 일으키는 것으로 알려져 있다면, 도메인에 가입된 컴퓨터나 AD를 쿼리하여 컴퓨터 계정 암호가 다음에 변경되도록 예약된 시기를 확인할 수 있습니까?

답변1

이를 위해 도메인을 쿼리하는 것이 가능합니다. 아래 스크립트는 특정 컴퓨터의 도메인 비밀번호가 마지막으로 재설정된 시기를 알려줍니다.

'Replace "yourdom.com" with your domain name.
DomainName = "yourdom.com"

querymachine = UCase(inputbox("Enter full machine name"))
lngBias = 2

'****************Setup Log file******************************************************

Set fso = CreateObject("Scripting.FileSystemObject")
'The 8 in this line will append to an existing file, replace with a 2 to override
set txtStream = fso.OpenTextFile("System.txt", 8, True)
txtStream.WriteLine "Ran on " & Date & " *******************************"

'****************Setup ADSI connection and populate ADSI Collection******************

Set objADOconnADSI = CreateObject("ADODB.Connection")
objADOconnADSI.Open "Provider=ADsDSOObject;"
Set objCommandADSI = CreateObject("ADODB.Command")
objCommandADSI.ActiveConnection = objADOconnADSI
'there is a 1000 object default if these next 2 lines are omited.
objCommandADSI.Properties("Size Limit")= 100000
objCommandADSI.Properties("Page Size")= 100000
objCommandADSI.Properties("Sort on") = "sAMAccountName"
objCommandADSI.CommandText = "<LDAP://" & DomainName & ">;(objectClass=computer);sAMAccountName,pwdLastSet,name,distinguishedname,operatingSystem;subtree"
Set objRSADSI = objCommandADSI.Execute

'Loop through record set and compare machine name*************************************

do while NOT objRSADSI.EOF
    if not isnull(objRSADSI.Fields("distinguishedname")) and objRSADSI.Fields("distinguishedname") <> "" then
    objDate = objRSADSI.Fields("PwdLastSet")
    'Go to function to make sense of the PwdLastSet value from AD for the machine account.
    dtmPwdLastSet = Integer8Date(objDate, lngBias)
    'calculate the current age of the password.
    DiffADate = DateDiff("d", dtmPwdLastSet, Now)

    'Is the machine the one we're looking for?
        if UCase(objRSADSI.Fields("name")) = querymachine then
        txtStream.WriteLine objRSADSI.Fields("name") & ";" & dtmPwdLastSet & ";" & DiffADate & ";" & objRSADSI.Fields("operatingSystem") 
        wscript.echo objRSADSI.Fields("name") & ", Last set: " & dtmPwdLastSet & ", Days since last change: " & DiffADate
        end if
    end if
objRSADSI.MoveNext
loop
wscript.echo "Done!"



Function Integer8Date(objDate, lngBias)
' Function to convert Integer8 (64-bit) value to a date, adjusted for
' local time zone bias.
Dim lngAdjust, lngDate, lngHigh, lngLow
lngAdjust = lngBias
lngHigh = objDate.HighPart
lngLow = objdate.LowPart
' Account for bug in IADslargeInteger property methods.
If lngLow < 0 Then
lngHigh = lngHigh + 1
End If
If (lngHigh = 0) And (lngLow = 0) Then
lngAdjust = 0
End If
lngDate = #1/1/1601# + (((lngHigh * (2 ^ 32)) _
+ lngLow) / 600000000 - lngAdjust) / 1440
Integer8Date = CDate(lngDate)
End Function 

(위 스크립트에 대한 공로를 인정하고 싶지만 사람마다 전달되고 다양한 방식으로 수정되었으므로 원래 출처가 어디인지 모르겠습니다.)

이것을 MachinePasswordDate.vbs와 같은 이름으로 저장합니다. Windows에서 파일을 두 번 클릭하면 컴퓨터 이름을 입력할 수 있는 상자가 팝업되어 도메인에 쿼리하고 해당 컴퓨터의 암호가 마지막으로 변경된 시기를 알려줍니다.

가상 머신 스냅샷을 정기적으로 복원하는 경우 이미지를 저장하기 전에 해당 머신의 보안 정책을 살펴보는 것이 좋습니다. 도메인 GPO가 이를 재정의하지 않고 보안 정책이 다음과 같은 종류의 작업을 허용한다고 가정하면 시스템 암호 재설정 간격을 최대 999일까지 매우 쉽게 변경할 수 있습니다.

시작, 실행을 차례로 클릭하고 Gpedit.msc를 입력한 다음 Enter 키를 누릅니다.

로컬 컴퓨터 정책, 컴퓨터 구성, Windows 설정, 보안 설정, 로컬 정책, 보안 옵션을 차례로 확장합니다.

다음 설정을 구성합니다.

  • 도메인 구성원: 컴퓨터 계정 비밀번호 변경 비활성화(활성화)

  • 도메인 구성원: 최대 컴퓨터 계정 비밀번호 사용 기간(999일)

  • 도메인 컨트롤러: 컴퓨터 계정 비밀번호 변경 거부(활성화)

답변2

DC 또는 RSAT가 있는 모든 컴퓨터에서 다음을 실행할 수 있습니다.dsquery computer -name ComputerName -stalepwd x

ComputerName은 확인하려는 컴퓨터의 이름입니다.
x는 비밀번호가 마지막으로 설정된 이후의 일수입니다.

x일 이후로 비밀번호가 설정되지 않은 경우 컴퓨터의 이름과 컨테이너가 반환됩니다. 지난 x일 이내에 비밀번호가 설정된 경우 아무 것도 반환되지 않습니다.

관련 정보