0 votes

Hi,

I would like to have a copy of Report "Errors in Adaxes log" and exlcude one or more specific Initiators in this report (cause they are generating a lot of errors sometimes ...)

Can I do this easy with default options? Or do I need to create an own report by script?

image.png

by (1.5k points)

1 Answer

0 votes
by (289k points)

Hello,

There is no easy way to do that as the Errors in Adaxes log report is based on the Adaxes log one. To achieve the desired, you need to copy the Adaxes log report and update the script used to generate it according to your needs. The following article should be helpful: https://adaxes.com/sdk/GeneratingReports.

0

Thanks, will check this out and try to build my needed report : )

0

Hi,

looks like I found a workaround for me.

Currently I am struggeling to get the ExecutionLog of each record entry.

I found this function , but how to use it correctly?

GetExecutionLog()
0

Hello,

The method returns a collection of objects. You can iterate through the collection and obtain properties of the objects. At the same time, it does not seem to be of any use in your case. As you need to filter out log records for operations initiated by certain users, you need to use property IAdmLogRecord::Initiator.

0

I made this PowerShell script to get only relevant entries

[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi")

$numDays = 1 # set to 0 to output all records

$ns = New-Object("Softerra.Adaxes.Adsi.AdmNamespace")
$service = $ns.GetServiceDirectly("localhost")

# Bind to the directory object representing the General Log
$path = $service.Backend.GetConfigurationContainerPath("ServiceLog")
$serviceLog = $service.OpenObject($path.ToString(), $null, $null, 0)

$generalLog = $serviceLog.GeneralLog
if ($numDays -ne 0) {
    $generalLog.StartDateTime = (Get-Date).AddDays(-$numDays)
    $generalLog.EndDateTime = Get-Date
}

# Get the log records
$log = $generalLog.Log
$records = $log.GetPage(0)

# Output the log records
foreach ($record in $records) {
    if (($record.State -ieq "OPERATION_STATE_COMPLETED")) {
        continue;
    }

    if (($record.Initiator.Name -ieq "XYZ")) {
        continue;
    }

    Write-Host "State:" $record.State
    Write-Host "Start Time:" $record.StartTime
    Write-Host "Completion Time:" $record.CompletionTime
    Write-Host "Initiator:" $record.Initiator.Name
    Write-Host "Target Object:" $record.TargetObjectName
    Write-Host "Target Object Type:" $record.TargetObjectType
    Write-Host "Operation:" $record.Description
    Write-Host
}

How can I get the ExecutionLog now for each record?

0

Hello,

As you are trying to that in Windows PowerShell, there is no easy way to do that at all. You will need to get the execution log using method GetExecutionLog for each log record and play with the output for each entry is the log. The easiest way is to just use the below script to generate a report in Adaxes. The report will not need a scope or any other settings. In the output, you will be able to right-click a log record, click Properties and view the log record details.

$numDays = 1 # set to 0 to output all records

# Bind to the directory object representing the General Log
$path = $Context.GetWellKnownContainerPath("ServiceLog")
$serviceLog = $Context.BindToObject($path)

$generalLog = $serviceLog.GeneralLog
if ($numDays -ne 0) {
    $generalLog.StartDateTime = (Get-Date).AddDays(-$numDays)
    $generalLog.EndDateTime = Get-Date
}

# Get the log records
$log = $generalLog.Log
$records = $log.GetPage(0)

# Output the log records
foreach ($record in $records) {
    if (($record.State -ieq "OPERATION_STATE_COMPLETED")) {
        continue
    }

    if (($record.Initiator.Name -ieq "XYZ")) {
        continue
    }

    $Context.Items.Add($record)
}
0

Thanks.

I was now able to generate a report directly in Adaxes Console. image.png

Is there a way to export this data with Execution log?

Or is there a way to get the execution log for each record via PowerShell only (not PowerShell to be used in Report script area)?

PowerShell native I was able to export only errors to a CSV file - but execution log is missing

[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi")
$numDays = 1 # set to 0 to output all records

$ns = New-Object("Softerra.Adaxes.Adsi.AdmNamespace")
$service = $ns.GetServiceDirectly("localhost")

# Bind to the directory object representing the General Log
$path = $service.Backend.GetConfigurationContainerPath("ServiceLog")
$serviceLog = $service.OpenObject($path.ToString(), $null, $null, 0)

$generalLog = $serviceLog.GeneralLog
if ($numDays -ne 0) {
    $generalLog.StartDateTime = (Get-Date).AddDays(-$numDays)
    $generalLog.EndDateTime = Get-Date
}

# Get the log records
$log = $generalLog.Log
$records = $log.GetPage(0)

[System.Collections.ArrayList]$output = @()

# Output the log records
foreach ($record in $records) {
    if (($record.State -ieq "OPERATION_STATE_COMPLETED")) {
        continue;
    }

    if (($record.Initiator.Name -ieq "XYZ")) {
        continue;
    }

    # Not working
    #$exlog = GetExecutionLog($record)

    $output += $record
}

$file_data = "State;StartTime;CompletionTime;Initiator.Name;TargetObjectName;TargetObjectType;Description`r`n"
$output | % { $file_data += "$($_.State);$($_.StartTime);$($_.CompletionTime);$($_.Initiator.Name);$($_.TargetObjectName);$($_.TargetObjectType);$($_.Description);`r`n"}
$file_data | Out-File "c:\temp\adaxes_only-error.csv"
0

Hello,

Unfortunately, there is no easy way to do that. You will need to not only obtain the execution log for each log records, but also process each of them in a very complex way.

Related questions

0 votes
1 answer

Hello dear ADAXES community, what i wanted to do is, to have a custom report which does the following: get every group in a specific OU (the OU comes from an adaxes custom ... Add($Group.name) } } is this possible in such a way? thank you for your help

asked Sep 23, 2020 by m_st (200 points)
0 votes
1 answer

Hi there, I've created a Delete User feature in the Web Interface Configurator. I am trying to restrict object selection via a User Criteria. Need to exclude Service ... won't appear when selecting target user for the 'Delete User' feature. Thanks, David

asked Sep 19 by dshortall (80 points)
0 votes
1 answer

Need to exclude spaces, dashes and appostrophes.

asked Feb 3, 2023 by mightycabal (1.0k points)
0 votes
1 answer

Hallo Everyone I've seen the Report for Exchange Mailboxes with OU, Send on Behalf, Full Rights and Send As Rights: https://www.adaxes.com/questions/ ... . Example: User: Peter.Steinmann Identity: Which Mailboxes AccessRights: FullAccess Kind regards,

asked Jul 6, 2022 by Sandberg94 (340 points)
0 votes
1 answer

I'd like the Password Never Expires to exclude certain users. Since it is script based is the only way to do so in the script? I have checked where I am aware and I do not see the possibility of doing this as it is currently configured. Thank you

asked Nov 15 by msheppard (470 points)
3,548 questions
3,238 answers
8,232 comments
547,812 users