0 votes

Hi - random PowerShell question (I do seem to ask more PowerShell questions than Adaxes questions...!).

We have a little bit of code to return the current value of an AD attribute as below, and it should update a different timestamp attribute in AD after reading it.

I have it almost working but am 'very' bad at working out how to properly convert variables in PowerShell, and need to create "$newNums" which is derived from a Date\Time stamp, into a Windows NT time numeric value, then into an Adaxes.ADSI.LongInteger (I think!).

        # Set new timestampin 24 hours
        $newTime = (Get-Date).AddDays(1)

        $newNums= << Can’t work out how to convert the GetDate format timestamp to a “Windows Time” Adaxes format Long Integer>>

        $pc.Put("<<attribute>>", $newNums)
        $pc.SetInfo()  

Anyone who can work this out is my hero..!

Rgds

by (1.6k points)

1 Answer

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

Hello,

This one will work:

# Set new timestampin 24 hours
$newTime = (Get-Date).AddDays(1)

$newNums= [Softerra.Adaxes.Adsi.ADsLargeInteger]$newTime.ToFileTime()

$pc.Put("<<attribute>>", $newNums)
$pc.SetInfo()
0

Thanks - it's always so easy when you see it on paper!

Related questions

0 votes
1 answer

Hi, Is there any native way to auto-increment a custom interger attribute? I know I can use a PS script, but just wondering whether there is a quick way to use an Adaxes action i.e. "CustomAttributeInt1 = CustomAttributeInt1+1" Thanks

asked May 29, 2013 by firegoblin (1.6k points)
0 votes
1 answer

Good afternoon, I am attempting to create a report to flag Users where the email address in AD does not match the email address in our Payroll system. I am able to use ... ) to grab User objects. Any help or input would be greatly appreciated. Thank you, Keith

asked Aug 12, 2021 by kfrench (20 points)
0 votes
1 answer

Hi, I am running a report to dump some attributes. I have one attribute that is Yes or No in AD. I want to transform that when generating that in a report. &lt;br&gt ... I believe it is script in a report -specific column but not sure how to construct. Thanks.

asked Jun 26, 2021 by techg (240 points)
0 votes
1 answer

Hi, is there possibility to search some custom string across all powershell script files used in Adaxes? I.e. Custom commands, Scheduled tasks etc I need to find out where is used some PowerShell command to be able to replace it for another one..

asked Apr 27, 2020 by KIT (520 points)
0 votes
1 answer

Is it possible for the approval email to display the picture? I've been unable to find the configuration panel for this process. Attached is the message we receive.

asked Mar 2, 2020 by kcd (20 points)
2,733 questions
2,469 answers
6,460 comments
1,336,556 users