Lua script to export user and Group membership

You can share your Lua Scripts with everybody here.

Lua script to export user and Group membership

Postby wuserbusiness » 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
wuserbusiness
 
2
 
Wed Sep 02, 2020 8:35 pm

Re: Lua script to export user and Group membership

Postby FTP » Fri Sep 04, 2020 1:06 am

OK, it means no user account returned by function "c_GetUserList", maybe the domain name "MYDOMAIN.com" is wrong?
FTP
Site Admin
 
1763
 
Tue Sep 29, 2009 6:09 am

Re: Lua script to export user and Group membership

Postby wuserbusiness » Tue Sep 08, 2020 8:12 pm

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.
wuserbusiness
 
2
 
Wed Sep 02, 2020 8:35 pm


Return to Lua scripts

Who is online

Users browsing this forum: No registered users and 2 guests