Script to Export User info Including Folders

You can share your Lua Scripts with everybody here.

Script to Export User info Including Folders

Postby ajmcqueen15 » Mon Mar 13, 2017 1:48 pm

Hi

I am able to export basic user info using another script example (see below) that I run through the console.
But I need to add additional folder information to each user account as follows:

Home Folder
Other defined folder paths including virtual folders (and the underlying folder they point to).
Permissions of folder.

Can anyone help?

Below is my user account extraction script so far:

do
local strDomain = "MyDomain"
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:/temp/MACE-user-info.txt", "wb"))
fp:write(strResult)
fp:close()
end
ajmcqueen15
 
1
 
Mon Mar 13, 2017 12:24 pm

Re: Script to Export User info Including Folders

Postby FTP » Tue Mar 14, 2017 4:12 pm

OK, just give you an example:

Code: Select all
         
for _,directory in pairs(user["directories"]) do
   if directory.is_home_dir then
      strResult = strResult.."Home dir: "..directory.dir.."\n"
   else
      strResult = strResult.."Virtual dir: "..directory.dir.."\n"
   end

   strResult = strResult.."File read: "..tostring(directory.fileread).."\n"
   strResult = strResult.."File write: "..tostring(directory.filewrite).."\n"
   strResult = strResult.."File append: "..tostring(directory.fileappend).."\n"
   strResult = strResult.."File delete: "..tostring(directory.filedelete).."\n"
   strResult = strResult.."File rename: "..tostring(directory.filerename).."\n"

   strResult = strResult.."Dir list: "..tostring(directory.dirlist).."\n"
   strResult = strResult.."Dir make: "..tostring(directory.dirmake).."\n"
   strResult = strResult.."Dir delete: "..tostring(directory.dirdelete).."\n"
   strResult = strResult.."Dir rename: "..tostring(directory.dirrename).."\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 3 guests