Changing File Permission using VBScript

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

I am creating a txt file using following script when the user logs in. Now
what I want to do is take ownership of that file and deny access to all users
expect one group - this group will have read access to the file. I want
domain administrators to have full rights to the file.

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objNet = CreateObject("WScript.NetWork")

If NOT objFSO.FileExists("\\advad02\Profiles\Notepads\owner\" +
objNet.UserName + ".txt") Then

strPath = "\\advad02\Profiles\Notepads\owner\"
strFileName = objNet.UserName + ".txt"
strFullName = objFSO.BuildPath(strPath, strFileName)
Set objFile = objFSO.CreateTextFile(strFullName)
objFile.Close

End if
 
You'd be better off asking this in a newsgroup related to scripting, such as
microsoft.public.scripting.vbscript.

This newsgroup is for questions about security in Access, the database
product that's part of Office Professional.
 
Back
Top