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 All, I am currently using the 30 day free trial of Adaxes and seeing if we can use it to achieve our method of user provisioning. I am looking into server-side ... variable value within an SQL query Can this be achieved? Any help is much appreciated, Thanks

asked Feb 1 by Lewis (40 points)
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

Hi, I would like to add a CSV file during my group creation form and add users from CSV to new created group. However the CSV file is converted into Binary file and I am ... help is really appreciated. Thanks! PS: What I tried so far and error message I got

asked Jul 3, 2023 by wintec01 (1.1k 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

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,348 questions
3,049 answers
7,791 comments
545,047 users