0 votes

Hello,

I have been working on a way that will allow us to provision accounts and enable them automatically on their specified start date. I'm using an extensionAttribute to write the date during account creation and then running a separate scheduled task to run a script that checks the current date vs their extensionAttribute date. The script runs in seconds when I run it from the powershell window, but the scheduled task runs indefinitely and is not activating accounts.

Any idea why the script isn't working when ran through Adaxes? (The service account running the script is a domain admin)

 Import-Module Adaxes  
 $Date = Get-Date -format MM/dd/yy  
 $DisabledUsers = Get-ADmUser -Filter {enabled -ne $True -AND extensionAttribute2 -le $Date} -Properties extensionAttribute2  


 Foreach ($DisabledUser in $DisabledUsers)  
 {  
  Set-ADmUser $DisabledUser -Enabled $True -Clear "extensionAttribute2"  
  }  


 Exit

Thanks,

by (100 points)

1 Answer

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

Hello Jo,

The issue occurs because extensionAttribute2 is a String property, while you need a date one. We recommend using one of Adaxes custom Date attributes, for example CustomAttributeDate1.

Related questions

0 votes
1 answer

Hi, I'm currently facing a problem where I want to set up a powershell script that should report all accounts (enabled, disabled, expired) matching a specific employeeType ... something else, just the plain Info Can you help me with this? kind regards Ingemar

asked Sep 4, 2015 by ijacob (960 points)
0 votes
1 answer

I am having an issue running a powershell script through Adaxes. I am trying to have this run as a business rule when ... $optoffice.DisabledServicePlans = "ONEDRIVESTANDARD" Set-MsolUserLicense -UserPrincipalName %userPrincipalName% -LicenseOptions $optOffice

asked Mar 2, 2015 by malsobrook (50 points)
0 votes
1 answer

Adaxes is set up to manage two forests. The server that Adaxes is running on is a member of the main corporate forest and we added the other untrusted forest (single ... -add @{info=$grouplist} } $Context.LogMessage("Removed from all groups", "Information")

asked Dec 31, 2012 by jiambor (1.2k points)
0 votes
1 answer

So if i want to run an external program and use a script i would put - cscript.exe registerUser.vbs ... but where should this script be saved to for adaxes to pick it up?

asked Mar 14, 2018 by ScottGriff (400 points)
0 votes
1 answer

I have a scheduled task that runs the following PowerShell script. $user = New-AdmUser -Server $domain -AdaxesService localhost -Path $workdayDn -ChangePasswordAtLogon $true -PassThru - ... ) over all objects. I'm stumped! Any help would be super appreciated.

asked Sep 5 by emeisner (100 points)
3,553 questions
3,244 answers
8,245 comments
547,831 users