Jump to content


  • 0
balubeto

Take ownership of a not system directory structure

Question

Hi

 

Should I take ownership and get full control of the entire contents of a not system directory structure (also containing files and symbolic links and not) that, now, this check belongs to TrustedInstaller or System users.

 

Then, from the Command Prompt, how do I do this?

 

Thanks

 

Bye

Share this post


Link to post
Share on other sites

8 answers to this question

Recommended Posts

  • 0

Ok, I will bite, why do you want to do this in the first place?

 

With the command

 

takeown /f "<Apply_Directory_Path>" /R /A /D Y

 

I can take ownership of the entire contents of this structure but can not delete it.

 

My problem is that of having to delete the entire contents of the structure created with the commands

 

 

Dism /Apply-Image /ImageFile:"<wim_File_Path>\install.wim" /Index:1 /ApplyDir:"<Apply_Directory_Path>" /Verify /CheckIntegrity

Dism /Capture-Image /ImageFile:"<Windows_Files_Path>\sources\install.wim" /CaptureDir:"<Apply_Directory_Path>" /Name:"<Edition_name>" /Description:"<Description_name>" /Compress:max /Verify /CheckIntegrity

 

Then, using the Command Prompt, how do I do this?

 

 

Thanks

 

Bye

Share this post


Link to post
Share on other sites

  • 0

 

With the command

takeown /f "<Apply_Directory_Path>" /R /A /D Y

I can take ownership of the entire contents of this structure but can not delete it.

 

My problem is that of having to delete the entire contents of the structure created with the commands

Dism /Apply-Image /ImageFile:"<wim_File_Path>\install.wim" /Index:1 /ApplyDir:"<Apply_Directory_Path>" /Verify /CheckIntegrity

Dism /Capture-Image /ImageFile:"<Windows_Files_Path>\sources\install.wim" /CaptureDir:"<Apply_Directory_Path>" /Name:"<Edition_name>" /Description:"<Description_name>" /Compress:max /Verify /CheckIntegrity

Then, using the Command Prompt, how do I do this?

 

 

I'm still not understanding what exactly the problem is. So you have applied a WIN to a computer????? And now you are trying to capture it?????

Share this post


Link to post
Share on other sites

  • 0

 

I'm still not understanding what exactly the problem is. So you have applied a WIN to a computer????? And now you are trying to capture it?????

 

Simply, now, I would like to delete the entire contents of the Apply_Directory_Path directory?

 

So, what are the commands to do this?

Share this post


Link to post
Share on other sites

  • 0

Some directories/reg keys are protected, even from an Administrator. use the local System account to delete the folders.

How do I do this?

 

 

I also hidden and system files in this structure.

 

I also have a subdirectory structure that I can not see its owner, and when I try to open it, File Explorer request the sysadmin authorization although I am logged on with an Administrators account. Why?

 

How do I prevent this? Using the Command Prompt, how do I become owner of this subdirectory structure with complete control over it so that I can also delete it?

 

So, what is your solution?

 

Thanks

 

Bye

Share this post


Link to post
Share on other sites

  • 0

I think I found the best solution to remove a directory structure which also contains symbolic links and with ACLs managed by TrustedInstaller or Authenticated Users or System users:

 

 

takeown /F "<Directory_path>" /A /R /D Y /SKIPSL >nul 2>&1
icacls "<Directory_path>" /reset
icacls "<Directory_path>" /grant:r Administrators:(OI)(CI)F /inheritance:e /Q /C /T /L >nul 2>&1
pushd "<Directory_path>" && ( rd /S /Q "<Directory_path>" 2>nul & popd )

 

Thanks

 

Bye

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.