0 votes

hello permission to ask about how to make a report based on time span, in my case, I want to create a report of the recently created user but the result of my script execution doesn't show anything.

here is the script from my code:

`# Get parameter values
$str = "%param-str%"
$end = "%param-end%"

$span = New-TimeSpan -Start $str -End $end


# Search filter
$filterUsers = "(&(sAMAccountType=805306368)(|(!(msExchRecipientTypeDetails=*))(!(msExchRecipientTypeDetails:1.2.840.113556.1.4.804:=7276219883574))))"
$filterCreatedAfter = "(whenCreated>=$span)"
$filter = "(&" + $filterUsers + $filterCreatedAfter + ")"
$Context.DirectorySearcher.AppendFilter($filter)

# Generate report
$Context.Items.Add($Context.DirectorySearcher)`

Output Script:

Capture.PNG

by (100 points)

1 Answer

0 votes
by (272k points)

Hello,

To achieve the desired behavior, there is no need to use scripts. You can have the report generated based on search and use the following LDAP filter:

(&(sAMAccountType=805306368)(whenCreated>=%param-str:format[yyyyMMddHHmmss.0Z],,,utc%)(whenCreated<=%param-end:format[yyyyMMddHHmmss.0Z],,,utc%)(|(!(msExchRecipientTypeDetails=*))(!(msExchRecipientTypeDetails:1.2.840.113556.1.4.804:=7276219883574))))

For more details on how to use value references, have a look at the following helpa rticle: https://www.adaxes.com/help/ValueReferences.

0

Thank you is solved

Related questions

0 votes
1 answer

Hi, I've tried to modify a existing report to my needs, without success. The requirement ist to see the add/moved from a group. Like here: Would this be possible with Adaxes? Thanks

asked Feb 20, 2023 by boris (470 points)
0 votes
1 answer

Good Day I've found what i want and is this Scripts Repository https://www.adaxes.com/script-repository/output-the-last-time-a-distribution-list-received-mail-s122.htm. Is ... in to a Report with the addition to add one more then one Distribution? Thank you

asked May 11, 2022 by Sandberg94 (340 points)
0 votes
1 answer

Hello! I would like to use the utc parameter that is described in value references - date/time formatting (https://www.adaxes.com/help/ValueReferences/). The goal is ... please indicate whiich would be the right way for using the utc switch? Thanks, Fabiano

asked 2 days ago by fabiano.santos-agco (20 points)
0 votes
2 answers

I've had a couple custom commands configured since 6/2023 and they've been working just fine up until recently (sometime within the past few weeks or so). Here's a general ... something obvious here. But I can't make sense of why this is suddenly an issue.

asked Mar 20 by msinger (110 points)
0 votes
1 answer

Hello, I have a lot of rule-based groups which are updated every day at 5 a.m. but now I would like to change the synchronization time for all groups, for ... custom command be created which updates all groups when executed? Many thanks for your help! D.

asked Jan 9 by DRiVSSi (280 points)
3,358 questions
3,057 answers
7,805 comments
545,194 users