Sorry, search feature is not supported in Internet Explorer 11

Enumerating computer accounts

The following code sample enumerates computer accounts located in a specific Organizational Unit.


# Connect to the Adaxes service
$admNS = New-Object "Softerra.Adaxes.Adsi.AdmNamespace"
$admService = $admNS.GetServiceDirectly("localhost")

# Bind to the Organizational Unit
$containerDN = "CN=Computers,DC=domain,DC=com"
$container = $admService.OpenObject("Adaxes://$containerDN", $NULL, $NULL, 0)

$container.Filter = @("computer")

foreach ($computer in $container)
    Write-Host $computer.Get("name")
Import-Module Adaxes

$containerDN = "CN=Computers,DC=domain,DC=com"

$computers = Get-AdmComputer -Filter * -SearchBase $containerDN  `
    -SearchScope OneLevel -Server "" -AdaxesService localhost 

foreach ($computer in $computers)
    Write-Host $computer.Name

See also