Script to Export User info Including Folders

You can share your Lua Scripts with everybody here.
Post Reply
ajmcqueen15
Posts: 1
Joined: Mon Mar 13, 2017 12:24 pm

Script to Export User info Including Folders

Post by ajmcqueen15 »

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
FTP
Site Admin
Posts: 2104
Joined: Tue Sep 29, 2009 6:09 am

Re: Script to Export User info Including Folders

Post by FTP »

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
Post Reply