I am new to lua script, I have never tried it before. I tried few lines in console but don’t know where output is going. Also scheduled a task, same don’t know where is task output is.
I simply need below information all users in all domains. Can you please provide me script for this and guide how to execute that !
Domain AccountName LastLogin Expiration sFTPKey or Username/Password
function "print()" will display output but how to export output to excel,txt etc.
How to run and direct output of LUA script.
-
- Posts: 3
- Joined: Mon Apr 21, 2014 5:23 pm
-
- Site Admin
- Posts: 2090
- Joined: Tue Sep 29, 2009 6:09 am
Re: How to run and direct output of LUA script.
OK, it seems you want to write the related user info into a file, so you can use such Lua script:
Code: Select all
do
local strDomain = "demo"
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:/result.txt", "wb"))
fp:write(strResult)
fp:close()
end