Need to export the list of users

You can share your Lua Scripts with everybody here.

Need to export the list of users

Postby mahesh.kumar » Wed Dec 26, 2018 8:51 pm

I need to schedule a task which exports the list of users with usernames and passwords in to a file. I have seen the LUA script to delete the inactive users. But I need the list of users. Can anyone please help?
mahesh.kumar
 
3
 
Wed Dec 26, 2018 8:49 pm

Re: Need to export the list of users

Postby FTP » Thu Dec 27, 2018 12:16 am

You can't export the user password, because the user password is MD5 encrypted.
FTP
Site Admin
 
1644
 
Tue Sep 29, 2009 6:09 am

Re: Need to export the list of users

Postby mahesh.kumar » Thu Dec 27, 2018 4:11 pm

Ok. I got that password can't be exported. I have the following script to export the username.

do
local strDomain = "mydomain"
local strUserlist = c_GetUserList(strDomain)
local userlist = Split(strUserlist,"\n")

local strResult = ""
for _,username in pairs(userlist) do
local user = c_GetUser(strDomain,username)
strResult = strResult..strDomain.."\t"..username.."\t"..user.last_logintime.."\t"..user.expiretime.."\n"
end

local fp = assert(io.open("c:/temp/MACE-user-info.txt", "wb"))
fp:write(strResult)
fp:close()
end

I created this task in the task scheduler.

Log says it executed successfully. But I can't see any output in my local file.
mahesh.kumar
 
3
 
Wed Dec 26, 2018 8:49 pm

Re: Need to export the list of users

Postby FTP » Fri Dec 28, 2018 4:07 am

OK, that Lua script has no problem, only need to replace "mydomain" into your own domain name.
FTP
Site Admin
 
1644
 
Tue Sep 29, 2009 6:09 am


Return to Lua scripts

Who is online

Users browsing this forum: No registered users and 1 guest