PC Review


Reply
Thread Tools Rate Thread

Changing File Permission using VBScript

 
 
=?Utf-8?B?U3VuUmFjZQ==?=
Guest
Posts: n/a
 
      15th May 2005
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
 
Reply With Quote
 
 
 
 
Douglas J. Steele
Guest
Posts: n/a
 
      15th May 2005
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.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)



"SunRace" <(E-Mail Removed)> wrote in message
news:9750ACC2-B1BC-4AE9-A3B4-(E-Mail Removed)...
> 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



 
Reply With Quote
 
=?Utf-8?B?U3VuUmFjZQ==?=
Guest
Posts: n/a
 
      15th May 2005
Sorry...I did realise the same .... I have asked the question there now....

"Douglas J. Steele" wrote:

> 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.
>
> --
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> (no e-mails, please!)
>
>
>
> "SunRace" <(E-Mail Removed)> wrote in message
> news:9750ACC2-B1BC-4AE9-A3B4-(E-Mail Removed)...
> > 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

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing pop server automatically in VBScript gcharhon@sentinelbox.com Microsoft Outlook 7 19th Jun 2007 05:06 PM
How give copy permission on a file without read permission Sam Windows Networking 1 19th Jan 2007 03:06 PM
Set Printer Advanced Permission by VBScript or DOS-Tool =?Utf-8?B?TWFydGluIERldkJ1aWxk?= Microsoft Windows 2000 Printing 0 15th Nov 2004 07:58 PM
Changing objectname in AD with vbscript Nico Leiska Microsoft Windows 2000 Active Directory 0 19th Nov 2003 12:43 PM
Changing VBScript File to JPEG Images file Harkirat Singh Windows XP Photos 4 19th Aug 2003 03:47 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:27 PM.