Hello and happy new year to everyone!
I try to add a translated date of the lastLogonTimeStamp to a report section in a workflow, it's the first time I try to add a script here to get a result.
- I created a "Search" activity called "Search for objects" and configured the parameters for my needs.
- I added a report section just displaying the samAccountName
- I tested --> OK
- I wrote a simple library script to convert a lastLogonTimeStamp to a readable format:
$date = $Workflow.FoundObject("Search for objects").Get("lastlogontimestamp")
$ReadableDate = [DateTime]::FromFileTimeUtc($date)
- I added the script to the report section and ran it, I get:
You cannot call a method on a null-valued expression.
At line:3 char:2
+ $date = $Workflow.FoundObject("Search for objects").Get("lastlogonti ...
Any idea of what I did wrong?