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 (510 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 (289k 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

+1 vote
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, 2022 by pudong (680 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)
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 May 3 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 (210 points)
0 votes
1 answer

Hello, you helped us with a script to set the oof-message. Now we want to know, if it's possible to activate/deactivate the mail-forwarding option time-based. In the ... deactivate it accordingly on "param-abw-ende" Can you help me with that? Thanks Carsten

asked Nov 17, 2022 by lohnag (160 points)
3,546 questions
3,237 answers
8,230 comments
547,809 users