Need help with LUA script to list all all users and their fi

You can share your Lua Scripts with everybody here.

Need help with LUA script to list all all users and their fi

Postby serveradmin2233 » Thu Sep 23, 2021 9:35 pm

Can't figure out the variable for the directory path for the user. I have this so far that will give me all expired accounts and the expiration date, but i would also like to list the directory path.

local domain = "basler.com"
local userlist = Split(c_GetUserList(domain), "\n")
for _,username in pairs(userlist) do
local user = c_GetUser(domain,username,dir)
if user.enable_expire == true then
local expiretime = c_TranslateTime(user.expiretime)
local nowtime = os.time()
if nowtime > expiretime then
print(username)
print(";")
print(user.expiretime)
print("\n")
end
end
end
serveradmin2233
 
2
 
Tue Jun 08, 2021 1:35 pm

Re: Need help with LUA script to list all all users and thei

Postby FTP » Fri Sep 24, 2021 4:43 pm

OK, you can list all the directory path by the following script:

Code: Select all
if user["directories"] ~= nil then
   for _,directory in pairs(user["directories"]) do
      if directory.is_home_dir then
         print("Home dir: "..directory.dir.."\n")
      else
         print("Virtual dir: "..directory.dir.."\n")
      end
   end
   print("\n\n")
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 1 guest

cron