How to run and direct output of LUA script.

You can share your Lua Scripts with everybody here.

How to run and direct output of LUA script.

Postby vijayrana » Tue Jan 19, 2016 1:52 am

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.
vijayrana
 
3
 
Mon Apr 21, 2014 5:23 pm

Re: How to run and direct output of LUA script.

Postby vijayrana » Tue Jan 19, 2016 7:23 am

Anyone ??
vijayrana
 
3
 
Mon Apr 21, 2014 5:23 pm

Re: How to run and direct output of LUA script.

Postby FTP » Wed Jan 20, 2016 7:03 am

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
FTP
Site Admin
 
1876
 
Tue Sep 29, 2009 6:09 am


Return to Lua scripts

Who is online

Users browsing this forum: No registered users and 2 guests