MSFN Forum: Automatically clear file permissions? - MSFN Forum

Jump to content



Unattended CD/DVD Guide Homepage · MSFN Forum Rules

If you have questions about customizing Windows XP that are nLite-specific, please post them in the nLite forum, not here. If you have questions regarding the unattended installation of Windows XP, please post them in the Unattended Windows 2000/XP/2003 section.
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Automatically clear file permissions? Possibly with a batch file?? Rate Topic: -----

#1 User is offline   dboone 

  • Newbie
  • Group: Members
  • Posts: 25
  • Joined: 23-June 04

Posted 11 October 2005 - 10:08 PM

I run a small computer repair shop. I often have to transfer data between hard drives due to a reformat or upgrade. During which I sometimes run into problems with file permissions that are set on directories or files from previous user accounts. I can sometimes override these setting by forcing new ownership through windows security settings however it doesn't always work right or doesn't change all the sub directories.

I would love to find a way to automatically clear all previous permissions and force new ones. A batch files would be great but all I can find so far are ones that remove file attributes.


Any Ideas from all you wonderful and knowledgeable people would be greatly appreciated.


- I need something that will work with both XP Home and Pro


Thx, Darin

This post has been edited by dboone: 11 October 2005 - 10:09 PM



#2 User is offline   Joc 

  • Junior
  • Pip
  • Group: Members
  • Posts: 91
  • Joined: 02-December 03

Posted 12 October 2005 - 01:08 AM

Hi,

for this problem i use cacls.exe which displays or modifies access control lists (ACLs) of files.
I think it is a part of some admin tools set...

See this: http://www.ss64.com/nt/cacls.html

Joc

This post has been edited by Joc: 12 October 2005 - 01:10 AM


#3 User is offline   DL. 

  • Tweaker or whatever I happen to be focused on at the moment..
  • PipPipPip
  • Group: Members
  • Posts: 489
  • Joined: 05-March 05
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 12 October 2005 - 05:28 AM

FOR %%i IN (*.*) DO cacls "%%i" /T /C /P "%USERNAME%":F

or

cacls *.* /T /C /P "%USERNAME%":F
xcacls *.* /T /C /Y /P "%USERNAME%":f

Cacls is included in WXP, Xcacls is part of some reskit and can be downloaded.
Xcacls can use the /Y switch which makes it possible to replace rights without verifying (read more on the site Joc mentioned).

I'm not sure, but it may be possible to use only the second command.
It may also be possible to replace "%USERNAME%" with a group name (e.g. administrators) or *.*/everyone.

I use cacls to give me full rights to the "System Volume Information"-folder in order to remove it (permanently).

This post has been edited by DL.: 12 October 2005 - 10:25 AM


#4 User is offline   Yzöwl 

  • Wise Owl
  • Group: Super Moderator
  • Posts: 4,195
  • Joined: 13-October 04
  • OS:Windows 7 x64

Posted 12 October 2005 - 08:19 AM

Try adding the Y automatically too
ECHO Y| CACLS "X:\Path" /T /C /G Administrators:F
Just change the X:\Path to suit.

#5 User is offline   oofki 

  • Junior
  • Pip
  • Group: Members
  • Posts: 74
  • Joined: 26-August 04

Posted 12 October 2005 - 08:30 AM

That or you can get subinacl.exe from microsoft

and use this in a batch:

subinacl /subdirectories %SystemDrive% /grant=administrators=f
subinacl /subdirectories %SystemDrive% /grant=system=f

#6 User is offline   dboone 

  • Newbie
  • Group: Members
  • Posts: 25
  • Joined: 23-June 04

Posted 12 October 2005 - 08:49 AM

Sounds great guys, I'll give it a shot today.


Off to work I go..

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2011 msfn.org
Privacy Policy