Hi Guys.
So i am using the code below that was provided from the Wiki. It sets the Account Expires value to a readable format in a VA.
The issue I am having is that I am seeing the error below when changing a VA value from TRUE to FALSE or FALSE to TRUE on a user account? I am not doing anything with the Account Expires value.
Any suggestions? I cant see why this would be popping up
Operation failed
Operation ID: 18-1987624
Operation GUID: 19d29d37-42e6-428b-a5e5-708631907722
Details:
The 'Script Execution' policy encountered an error when running the script 'AccountExpiresReadable'.
At line: 31 char:9. Exception calling "FromFileTime" with "1" argument(s): "Not a valid Win32 FileTime.
Parameter name: fileTime"
function IsAttributeModified ([string]$AttributeName, $Request)
{
$objEntry = $Request.GetPropertyItem($AttributeName, $Constants.ADSTYPE_CASE_IGNORE_STRING)
if ($objEntry -eq $null) { return $false }
if ($objEntry.ControlCode -eq 0) { return $false }
return $true
} #-- IsAttributeModified
function onPreModify($Request)
{
if($Request.class -ne "user"){return}
if(IsAttributeModified "accountExpires" $Request)
{
[string]$accountExpiresReadable = [datetime]::fromfiletime($Request.Get("accountExpires"))
$DirObj.Put("edsvaAccountExpiresReadable", $accountExpiresReadable)
$DirObj.SetInfo()
}
}