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 (216k 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

Hello, I'm wondering if there is something like the calculated property "%adm-RandomString%", but that also includes symbols. Is there another command that accomplishes this task, or ... 's characters? Any way I could get this done within the realm of Adaxes?

asked Jul 7, 2022 by NKB#2772 (50 points)
0 votes
1 answer

I had a script that would copy the values from adm-CustomAttributeTextMultiValue1 and save them into extensionAttribute15 as a comma seperated list. The script somehow got deleted and I can't seem to find the tutorial I used to create it before.

asked Jul 1, 2022 by jordan (110 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 (320 points)
3,071 questions
2,784 answers
7,155 comments
436,722 users