Need to export the list of users
-
- Posts: 3
- Joined: Wed Dec 26, 2018 8:49 pm
Need to export the list of users
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?
-
- Site Admin
- Posts: 2090
- Joined: Tue Sep 29, 2009 6:09 am
Re: Need to export the list of users
You can't export the user password, because the user password is MD5 encrypted.
-
- Posts: 3
- Joined: Wed Dec 26, 2018 8:49 pm
Re: Need to export the list of users
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.
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.
-
- Site Admin
- Posts: 2090
- Joined: Tue Sep 29, 2009 6:09 am
Re: Need to export the list of users
OK, that Lua script has no problem, only need to replace "mydomain" into your own domain name.