Quest Active Server Roles - Compare Dates Functions
function onInit($context)
{
if ($DirObj.class -eq "user")
{
# GET THE USERS UN
$userDN = $DirObj.Get("distinguishedname")
# SET ACCOUNT TO EXPIRE 30 DAYS AFTER
Set-QADUser $userDN -accountExpires (Get-Date).adddays(30)
}
}
# ACCOUNT EXPIRED IN INT8
function Expired($context)
{
$today = Get-Date
# CONVERT TO INT8
$futuredate = ((Get-Date).AddDays(-1)).ToFileTime()
$futuredate
}
# GET INT8 NUMBER THAT IS WITHIN 7 DAYS TO EXPIRE (NOTICE TIME)
function NoticeTime($context)
{
# CONVERT TO INT8
$futuredate = ((Get-Date).AddDays(7)).ToFileTime()
$futuredate
}
# ACCOUNT EXPIRED IN INT8
function 28DaysOLD($context)
{
$today = Get-Date
# CONVERT TO INT8
$futuredate = ((Get-Date).AddDays(-28)).ToFileTime()
$futuredate
}