Script Repository


Check whether date in object property is today

October 30, 2019
524

The script returns True if the date specified in an object property is equal to the current date. You can use the script in the If PowerShell script returns true condition in Business Rules, Scheduled Tasks and Custom Commands.

Parameter:

  • $property - Specifies the LDAP name of the property whose value will be compared with the current date.
Edit Remove
PowerShell
$property = "adm-CustomAttributeDate1" # TODO: modify me

# Get attribute value
try
{
    $compareDate = $Context.TargetObject.Get($property)    
}
catch
{
    $Context.ConditionIsMet = $False
    return
}

# Compare dates
$currentDate = [System.DateTime]::UtcNow
$Context.ConditionIsMet = $compareDate.Date -eq $currentDate.Date

Comments ( 0 )
No results found.
Leave a comment