Script repository

Computers that have Adaxes Self-service client installed

Updated on: Jan 18, 2026, Views: 3365

Miscellaneous

The script creates a CSV file including the computers that have the Adaxes Self-service client installed. To execute the script, create a scheduled task configured for the Domain object type and add a managed domain to the Activity Scope. The domain does not determine the computers to include into the CSV file and will only be used to execute the scheduled task itself.

In the script, the $csvFilePath variable specifies the path to the CSV file that will be created by the script.

To use the script, install the Adaxes PowerShell module on the computer where the service runs.

$csvFilePath = "\\SERVER\Share\Self-service client report.csv" # TODO: modify me

$computers = Get-AdmComputer -Filter *

$report = @()
foreach ($computer in $computers)
{
    $computerDN = New-Object "Softerra.Adaxes.Ldap.DN" $computer.DistinguishedName
    
    # Set default values for variables.
    $reportRecord = New-Object PSObject
    $reportRecord | Add-Member NoteProperty ComputerName $computer.Name
    $reportRecord | Add-Member NoteProperty ParentDN $computerDN.Parent
    $reportRecord | Add-Member NoteProperty AdaxesSelfServiceClientStatus $NULL
    $reportRecord | Add-Member NoteProperty ComputerStatus $NULL
    $reportRecord | Add-Member NoteProperty ErrorMessage $NULL
    
    # Connect to the remote computer using WMI.
    try
    {
        $programInfos = Get-WmiObject -ComputerName $computer.Name -Class Win32_Product -ErrorAction Stop | Select-Object Name, InstallState
        $reportRecord.ComputerStatus = "Online"
    }
    catch
    {
        # Computer is offline.
        $programInfos = @()
        $reportRecord.ComputerStatus = "Computer is unavailable"
        $reportRecord.AdaxesSelfServiceClientStatus = "Can not determine"
        $reportRecord.ErrorMessage = $_.Exception.Message
        $report += $reportRecord
        continue
    }

    # Search for Adaxes Self-service client.
    $installedState = "Not Installed"
    foreach ($programInfo in $programInfos)
    {
        if ($programInfo.Name -ine "Adaxes Self-Service Client")
        {
            continue
        }

        switch ($programInfo.InstallState)
        {
            -6
            {
                $installedState = "Bad Configuration"
            }
            -2
            {
                $installedState = "Invalid Argument"
            }
            -1
            {
                $installedState = "Unknown Package"
            }
            1
            {
                $installedState = "Advertised"
            }
            2
            {
                $installedState = "Absent"
            }
            5
            {
                $installedState = "Installed"
            }
        }

        break
    }

    # Add the computer to the report.
    $reportRecord.AdaxesSelfServiceClientStatus = $installedState
    $report += $reportRecord
}

# Export report to file.
if ($report.Length -gt 0)
{
    $report | Export-Csv $csvFilePath -NoTypeInformation
}

Comments 0

You must be signed in to comment.

    Got questions?

    Support Questions & Answers

    We use cookies to improve your experience.
    By your continued use of this site you accept such use.
    For more details please see our privacy policy and cookies policy.