Page 1 of 1

Lua script to export user and Group membership

Posted: Wed Sep 02, 2020 8:43 pm
by wuserbusiness
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

Re: Lua script to export user and Group membership

Posted: Fri Sep 04, 2020 1:06 am
by FTP
OK, it means no user account returned by function "c_GetUserList", maybe the domain name "MYDOMAIN.com" is wrong?

Re: Lua script to export user and Group membership

Posted: Tue Sep 08, 2020 8:12 pm
by wuserbusiness
Thanks, I have double checked the domain and its spelt and written as in Wing.

If i also run domainlist is shows the name specified.

Its definately failing on that part as i can run other lines ok.

Any ideas why it wint accep the domain? We are on a new build also.