Skip to content

Commit d602603

Browse files
committed
[Unattended answer file/ADDS] Replace account disable value with constant
1 parent 7988240 commit d602603

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

Elements/AutoUnattend/ActiveDirectory/DomainServicesModule.vb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,12 @@ Module DomainServicesModule
234234
Return String.Join(",", pathParts)
235235
End Function
236236

237+
''' <summary>
238+
''' The user account is disabled
239+
''' </summary>
240+
''' <remarks></remarks>
241+
Private Const ADS_UF_ACCOUNTDISABLE As Integer = &H2
242+
237243
''' <summary>
238244
''' Determines whether an account in a domain is enabled
239245
''' </summary>
@@ -262,7 +268,7 @@ Module DomainServicesModule
262268
Dim dirEntry As DirectoryEntry = result.GetDirectoryEntry()
263269
If dirEntry.NativeGuid = "" Then Return False
264270

265-
enabledStatus = Not Convert.ToBoolean(CInt(dirEntry.Properties("userAccountControl").Value) And &H2)
271+
enabledStatus = Not Convert.ToBoolean(CInt(dirEntry.Properties("userAccountControl").Value) And ADS_UF_ACCOUNTDISABLE)
266272
Next
267273
searcher.Dispose()
268274
Catch ex As Exception

0 commit comments

Comments
 (0)