Lua script to export user and Group membership
Posted: Wed Sep 02, 2020 8:43 pm
Hello
I have the below script I have found and edited to export a few pieces of information I need, in particular the Username and group membership of every user. But I get the error as per the below, any pointers appreciated?
some error in ... Files (x86)\Wing FTP Server\lua\ServerInterface.lua:1058: bad argument #1 to 'find' (string expected, got nil)!
Script is:
do
local strDomain = "MYDOMAIN.com"
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.."\t"..directory.dir.."\n"
end
local fp = assert(io.open("C:\wingtemp\user-info.txt", "wb"))
fp:write(strResult)
fp:close()
end
Thanks
I have the below script I have found and edited to export a few pieces of information I need, in particular the Username and group membership of every user. But I get the error as per the below, any pointers appreciated?
some error in ... Files (x86)\Wing FTP Server\lua\ServerInterface.lua:1058: bad argument #1 to 'find' (string expected, got nil)!
Script is:
do
local strDomain = "MYDOMAIN.com"
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.."\t"..directory.dir.."\n"
end
local fp = assert(io.open("C:\wingtemp\user-info.txt", "wb"))
fp:write(strResult)
fp:close()
end
Thanks