Jump to content

Taking ownership without removing existing user rights


Recommended Posts

Posted

Hi All,

 

I have a network share with lots of folders and files with ownership set to different users and explicit denies set against the domain admins group (don`t ask). I need to move the files to a new server, the existing server is a snap server.

I want to run a script to take ownership over every file and modify the existing rights. I have written a batch file (see below). The problem I have is that takeown /d y will strip out the existing rights on some folders.

 

takeown /f %1 /r /d y
icacls %1 /grant "domain\Domain Admins:F" /t > "C:\Logs\icacls.txt"

 

Is there a way to preserve all existing user rights while taking ownership and adding full access to a certain group?

 

Thanks

Andy

Posted

If you don't mind using SetACL, you could try this...

 

SetACL -on %1 -ot file -actn setowner -ownr "n:Domain\Domain Admins;s:n" -actn ace -ace "n:Domain\Domain Admins;p:full" -log C:\Logs\SetACL.txt

  • Thanks 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



  • 47 When would you like EduGeek EDIT 2025 to be held?

    1. 1. Select a time period you can attend


      • I can make it in June\July
      • I can make it in August\Sept
      • Other time period. Comment below
      • Either time

×
×
  • Create New...