Hello,
The script is expected to error out because it is not allowed to execute the New-TimeSpan cmdlet with only the -End
parameter. That is something you can see from the article we referenced in the previous post. Also, value reference %whenCreated%
will not work here as it will resolve into the property value of the initiator making the column value the same for all objects in the report. Here is the script you can use.
# Get object creation date
$object = $Context.GetDirectoryObject()
$whenCreated = $object.Get("whenCreated")
$timeSpan = New-TimeSpan -Start $whenCreated -End "%datetime%"
$Context.Value = $timeSpan.Days