Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Changing security settings of a file via a scheduled task or service

Posted on 2004-04-19
5
Medium Priority
?
266 Views
Last Modified: 2010-04-19
We have a programme running on Windows 2003 Server as a service.  It creates a log file, and everytime it writes to the log file it changes the security settings so only Administrator has rights to view the file.  Even if I manually reset the security settings on the file, when it next writes back to it, it resets the security back to Admin only.

I would like to run some sort of a programme that is scheduled to run a few minutes afterwards, that resets the security on the log file so that standard users can view the log file.

Does anyone know of any software that can do this??  

0
Comment
Question by:notable
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 16

Accepted Solution

by:
JamesDS earned 2000 total points
ID: 10866162
notable
You can use the CACLS command that comes with windows in a script:

CACLS filename [/T] [/E] [/C] [/G user:perm] [/R user [...]]
               [/P user:perm [...]] [/D user [...]]
   filename      Displays ACLs.
   /T            Changes ACLs of specified files in
                 the current directory and all subdirectories.
   /E            Edit ACL instead of replacing it.
   /C            Continue on access denied errors.
   /G user:perm  Grant specified user access rights.
                 Perm can be: R  Read
                              W  Write
                              C  Change (write)
                              F  Full control
   /R user       Revoke specified user's access rights (only valid with /E).
   /P user:perm  Replace specified user's access rights.
                 Perm can be: N  None
                              R  Read
                              W  Write
                              C  Change (write)
                              F  Full control
   /D user       Deny specified user access.
Wildcards can be used to specify more that one file in a command.
You can specify more than one user in a command.

Or you can use the XCACLS.EXE command that comes with the resource kit available at www.microsoft.com/reskit

Cheers

JamesDS
0
 

Author Comment

by:notable
ID: 10866605
CACLS does change the user rights correctly, but requires a user input (Y/N) when running.  I need to be able to schedule this to be run without user input.

Normally I just add a "<y.txt" at the end of the command line, and create a y.txt file with Y in it to automatically respond Y to this sort of question.  Doesn't seem to work in this instance.

XCACLS.EXE is not part of the 2003 resource kit.   Any other ideas where to find it, as it may not require the input that CACLS does.

Thanks.
0
 
LVL 16

Expert Comment

by:JamesDS
ID: 10866641
notable

doh!

XCACLS.EXE is part of the Windows 2003 support tools on the CD

Sorry for the confusion

Cheers

JamesDS

0
 

Author Comment

by:notable
ID: 10883342
Thanks.  XCACLS works great - it has an option for the /Y switch to force an answer of Yes.

Regards,
Russell.
0
 
LVL 16

Expert Comment

by:JamesDS
ID: 10886283
notable
Welcome, glad it works for you

Cheers

JamesDS
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The HP utility "HP Lights-Out Online Configuration Utility for Windows Server 2003/2008" could be of great use when it comes to remotely configure a HP servers ILO WITHOUT rebooting the server. We would only need to create and run scripts using thi…
Many of us need to configure DHCP server(s) in their environment. We can do that simply via DHCP console on server or using MMC snap-in on each computer with Administrative Tools installed in a network. But what if we have to configure many DHCP ser…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question