0 votes

Hi,

I copied report "recently created users" and added a parameter to check for specific value in extensionAttribute3.

If this attributes starts with e.g. value "startdate" , only those users should be shown. If not, all. (value is then empty in AD)

Config image.png image.png

Report is working fine if checkbox is checked and param value is set. Its not working with unchecked and empty value and I tried several options already (space, $null, * , %%, ? , ...)

Any idea how to build the report?

image.png image.png

by (1.1k points)

1 Answer

0 votes
by (272k points)

Hello,

Unfortunately, there is no possibility to achieve the desired behavior using criteria. It can only be done using a script. For example:

$parameterName = "param-MyParameter" #: TODO modify me
$valueWhenChecked = "startdat" #: TODO modify me

# Get parameter value
$parameterValue = $Context.GetParameterValue($parameterName)

# Build criteria
if ($parameterValue -eq $valueWhenChecked)
{
    $criteria = New-AdmCriteria "user" {mailboxType -ne "shared" -and whenCreated -lt "%param-Days%" -and extensionAttribute3 -contains $valueWhenChecked}
}
else
{
    $criteria = New-AdmCriteria "user" {mailboxType -ne "shared" -and whenCreated -lt "%param-Days%" -and extensionAttribute3 -empty $False}
}

# Generate report
$Context.DirectorySearcher.AddCriteria($criteria)
$Context.Items.Add($Context.DirectorySearcher)
0

Hi,

thanks for this idea. I needed to change the script logic, as no account was shown and your date logic seems wrong.

But now everything is working :)

$daysback = "%param-Days%"
$date = (Get-Date).AddDays(-$($daysback))

# Build criteria
if ($parameterValue -eq $valueWhenChecked)
{
    $criteria = New-AdmCriteria "user" {whenCreated -ge $date -and extensionAttribute3 -startsWith $valueWhenChecked}
}
else
{
    $criteria = New-AdmCriteria "user" {(whenCreated -ge $date) -and ( (extensionAttribute3 -empty $True) -or (extensionAttribute3 -empty $False) )}
}

Related questions

0 votes
1 answer

Hi! I need a report of user accounts with empty attributes. Is there a possibility to make such report? Thanks in advance.

asked Sep 11, 2009 by philip (20 points)
0 votes
1 answer

Is it possible to remove the default blank option that shows up in a multi-value field? When I add two possible options for a multi-value field in the Property Pattern constraint, ... along with the other two options. Is it possible to get rid of the blank?

asked Mar 8, 2017 by sdavidson (730 points)
0 votes
1 answer

Hi Can you lead us to what we are doing wrong with this report? `$CID ="{ed8afa99-e34d-4531-b69a-0bd0785f4d3a}" $folders = gci -force '\server\Kunden'-ErrorAction ... Value generation = Template, empty. ColumnID is double checked an is the right one. Thanks

asked Mar 5, 2020 by maca (100 points)
0 votes
1 answer

We are looking for a report to email our alerts email address after each scheduled tasks runs. It should report the successful and non successful operations alike. We are ... pulling the log files is only available from the server itself. Thanks in advance.

asked Mar 7, 2017 by willy-wally (3.2k points)
0 votes
1 answer

I'm creating a powershell script to handle all the 'modify user' steps, instead of having them be individual steps in Adaxes. This script runs after we fill out a form. A ... empty parameter considered as either a "tab" or "4 spaces" ? Thanks for your help.

asked Dec 12, 2022 by lw.fa (130 points)
3,351 questions
3,052 answers
7,791 comments
545,086 users