0 votes

I'm writing a PowerShell script that creates a group. I would like to include in the Notes field, both the Date and Time of the Request as well as the Date & Time of the Manager Approval.

<snip>

Thx!

--Joel

by (470 points)
0

Hello Joel,

What exactly do you need to be submitted for approval? Is it adding the new user account to the new group both created by the script?

What do you mean by Request name? Should it also be entered manually by the initiator along with the workstation name?

0

I'm writing a PowerShell script that (in part) creates a group. I would like to include in the Notes field, both the Date and Time of the Request as well as the Date & Time of the Manager Approval.

Example:
Requested by John Smith on 10/24/2018
Approved by Mary Jane on 10/26/2018

It is triggered by the Modify User link on the Self Service Portal. I have a Business Rule for "After Updating a User." The script will require Manager Approval to Run.

1 Answer

0 votes
by (228k points)
selected by
Best answer

Hello Joel,

Thank you for the provided details. You will need to save the request date into a property of the initiator account before running the script in your Business Rule. For example, you can use one of Adaxes custom date attributes (e.g. CustomAttributeDate1). In the script, you will need to get the date from the attribute and save it to the Notes property of the new group.

Then, you need to get the current date/time and also add it to the Notes property of the group. It will be different from the one saved to the custom attribute as the request can be approved any time. To add the approver (which is the manager of the requestor), use the %adm-InitiatorManagerFullName% value reference.
Below is a sample script:

# Get dates
$requestDate = $Context.TargetObject.Get("adm-CustomAttributeDate1")
$currentDate = Get-Date

# Form group notes
$notes = "Requested by %fullname% on $requestDate `r`n Approved by %adm-InitiatorManagerFullName% on $currentDate"

# Bind to the container
$containerDN = "OU=Groups,OU=DraculaTest,DC=aurora,DC=softerra,DC=llc"
$container = $Context.BindToObjectByDN($containerDN)

# Create group
[Softerra.Adaxes.Interop.Adsi.ADS_GROUP_TYPE_ENUM]$groupType =
    "ADS_GROUP_TYPE_GLOBAL_GROUP, ADS_GROUP_TYPE_SECURITY_ENABLED"
$group = $container.Create("group","CN=New Group1")
$group.Put("groupType", [Int32]$groupType)
$group.Put("info",$notes)
$group.SetInfo()

The Business Rule will look like the following:

0

Excellent! Thank you very much! That is exactly how I'm handling this. I just needed the extra bit about adding %datetime% to a temp user property at the time of the request and Get-Date for the time of the script after approval

Thanks again!

--Joel

Related questions

0 votes
1 answer

Hello I have two questions about date field in the the web GUI. Is it possible to determine the first day of the week? In my case Monday should be the first day of ... allow change time". I have not found this in the web configurator. thx &amp; regards pudong

asked Jul 8 by pudong (580 points)
0 votes
1 answer

In Web Configuration, under advanced section we have set the Iddle Sessiom time out limit to 20 minutes and also the Authentication idle time out limit to 20 minutes, however ... there is any other way we can enforce re-login after session times out ? Thanks

asked Feb 13, 2021 by rsaran (70 points)
+2 votes
1 answer

I am attempting to build out a report that shows all user accounts were approved by two different persons before being created. I have the workflow running correctly, ... this data stored in a specific location thats accessible by the reporting engine? Thanks!

asked Dec 16, 2019 by hendersonw (210 points)
0 votes
0 answers

Hello, I'm writing another approval cleanup script but i cannot seem to find the attribute I am looking for. When u check the Adaxes Console u can see a request date ... ://&lt;GUID=$guid&gt;" $request = $admService.OpenObject($requestPath, $NULL, $NULL, 0) }

asked Jul 14, 2015 by kerremansserge (470 points)
0 votes
1 answer

Hello Support, i've got two questions: I'd like to integrate the Threema API (https://gateway.threema.ch/de/developer/api) for sending messages instead of sending ... front type and size for the exchange automatic reply when using the Adaxes? Thanks Markus

asked Mar 16 by roppiffm (110 points)
2,803 questions
2,538 answers
6,609 comments
63,859 users