P
Peter Steele
I've found some VB code to query a domain controller to return the list of
all computers in that domain. The VB code is reasonably straightforward (see
below). How do I do the equivalent in C++? I've done a lot of searches and
haven't come up with much useful information. Any pointers would be
appreciated:
Public Function GetDomainComputers(ByVal strDomain)
Dim objIADsContainer ' ActiveDs.IADsDomain -
Dim objIADsComputer ' ActiveDs.IADsComputer
Dim vReturn ' Variant
Set objIADsContainer = GetObject("WinNT://" & strDomain)
' set the filter to retrieve only objects of class Computer
objIADsContainer.Filter = Array("Computer")
ReDim vReturn(0)
For Each objIADsComputer In objIADsContainer
If Trim(vReturn(0)) <> "" Then
ReDim Preserve vReturn(UBound(vReturn) + 1)
End If
vReturn(UBound(vReturn)) = objIADsComputer.Name
Next
GetDomainComputers = vReturn
Set objIADsComputer = Nothing
Set objIADsContainer = Nothing
End Function
all computers in that domain. The VB code is reasonably straightforward (see
below). How do I do the equivalent in C++? I've done a lot of searches and
haven't come up with much useful information. Any pointers would be
appreciated:
Public Function GetDomainComputers(ByVal strDomain)
Dim objIADsContainer ' ActiveDs.IADsDomain -
Dim objIADsComputer ' ActiveDs.IADsComputer
Dim vReturn ' Variant
Set objIADsContainer = GetObject("WinNT://" & strDomain)
' set the filter to retrieve only objects of class Computer
objIADsContainer.Filter = Array("Computer")
ReDim vReturn(0)
For Each objIADsComputer In objIADsContainer
If Trim(vReturn(0)) <> "" Then
ReDim Preserve vReturn(UBound(vReturn) + 1)
End If
vReturn(UBound(vReturn)) = objIADsComputer.Name
Next
GetDomainComputers = vReturn
Set objIADsComputer = Nothing
Set objIADsContainer = Nothing
End Function