List of Enabled/not-expired accounts

You can share your Lua Scripts with everybody here.

List of Enabled/not-expired accounts

Postby niqbert » Thu Sep 03, 2015 2:53 pm

I want to create a Task which emails account owners after n-days of not logging in.

Part of my script is this:

Code: Select all
   --Get user list from domain
   local strUserlist = c_GetUserList("test-domain")
   local userlist = Split(strUserlist,"\n")

However this gets all users. I need to exclude the "not Enabled accounts" and the accounts which already are set expired. Otherwise accounts which already are disabled and expired will get an email, which they should not get.

Could someone show how I can get a list of Enabled accounts which are not marked Expired yet?
Mon Jul 11, 2011 1:06 pm

Re: List of Enabled/not-expired accounts

Postby FTP » Mon Sep 21, 2015 2:36 am

OK, you just need such Lua script:

Code: Select all
local expiretime_t = c_TranslateTime(user.expiretime)
if user.enable_account == false and (user.enable_expire == false or (user.enable_expire == true and expiretime_t > os.time() ) )
Site Admin
Tue Sep 29, 2009 6:09 am

Re: List of Enabled/not-expired accounts

Postby thetigerzzz » Mon Oct 12, 2015 7:54 am

Need some thing like that BUT only Disabled user were deleted or list ?
can you help
Thu Jan 08, 2015 10:21 am

Return to Lua scripts

Who is online

Users browsing this forum: No registered users and 1 guest