Page 1 of 1

Dism /Apply-Image and completely remove the entire content of the directory

Posted: 10 Jan 2016 03:23
by balubeto
Hi

I installed Windows ADK 10 v1511 on Windows 10 v1511 Enterprise 64 bit.

I typed the following commands:

Code: Select all

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


Now, knowing that some directories and files have the TrustedInstaller or System user as owner, what are the commands that allows to completely remove the entire content of the <Apply_Directory_Path> directory?

Thanks

Bye

Re: Dism /Apply-Image and completely remove the entire content of the directory

Posted: 10 Jan 2016 10:26
by foxidrive
Do you want to script this, or just remove the folders?

Re: Dism /Apply-Image and completely remove the entire content of the directory

Posted: 10 Jan 2016 11:12
by balubeto
foxidrive wrote:Do you want to script this, or just remove the folders?


I would like to remove the entire contents of the Apply_Directory_Path directory.

I tried these commands

Code: Select all

takeown /F "<Apply_Directory_Path>\*" /R /A /D S

icacls "<Apply_Directory_Path>\*.*" /T /grant administrators:F

pushd "<Apply_Directory_Path>" && ( rd /S /Q "<Apply_Directory_Path>" 2>nul & popd )


but some subdirectories with their files are not deleted. Why?

Thanks

Bye

Re: Dism /Apply-Image and completely remove the entire content of the directory

Posted: 11 Jan 2016 15:34
by foxidrive
balubeto wrote:
foxidrive wrote:Do you want to script this, or just remove the folders?


I would like to remove the entire contents of the Apply_Directory_Path directory.

It's still not clear if it's something you need a script to do. The task can be done manually very easily.

Some locations are very difficult to gain access too in modern Windows.

Re: Dism /Apply-Image and completely remove the entire content of the directory

Posted: 12 Jan 2016 04:21
by balubeto
foxidrive wrote:
balubeto wrote:
foxidrive wrote:Do you want to script this, or just remove the folders?


I would like to remove the entire contents of the Apply_Directory_Path directory.

It's still not clear if it's something you need a script to do. The task can be done manually very easily.

Some locations are very difficult to gain access too in modern Windows.


I tried these commands

Code: Select all

takeown /F "<Apply_Directory_Path>\*" /R /A /D Y >nul 2>&1

icacls "<Apply_Directory_Path>\*.*" /T /grant administrators:F /T /Q

pushd "<Apply_Directory_Path>" && ( rd /S /Q "<Apply_Directory_Path>" 2>nul & popd )


but some subdirectories with their files are not deleted.

I also tried to restart Windows and repeat this sequence but those subdirectories are not yet eliminated. Why?

Thanks

Bye

Re: Dism /Apply-Image and completely remove the entire content of the directory

Posted: 12 Jan 2016 04:30
by foxidrive
balubeto wrote:but some subdirectories with their files are not deleted.


I'm just reminding you that I asked the same question twice, and am still waiting for an answer. :wink:

Re: Dism /Apply-Image and completely remove the entire content of the directory

Posted: 12 Jan 2016 05:02
by balubeto
foxidrive wrote:
balubeto wrote:but some subdirectories with their files are not deleted.


I'm just reminding you that I asked the same question twice, and am still waiting for an answer. :wink:


The sequence of my command is like a dos script (bat file). Right?

This sequence is performed from a "Command Prompt" window run as administrator.

Thanks

Bye

Re: Dism /Apply-Image and completely remove the entire content of the directory

Posted: 13 Jan 2016 04:55
by foxidrive
balubeto wrote:The sequence of my command is like a dos script (bat file). Right?

This sequence is performed from a "Command Prompt" window run as administrator.


My question was not about if it was run as administrator.

I have a solution if you are trying to do this on one computer, but not a script solution.

Re: Dism /Apply-Image and completely remove the entire content of the directory

Posted: 13 Jan 2016 05:16
by balubeto
foxidrive wrote:
balubeto wrote:The sequence of my command is like a dos script (bat file). Right?

This sequence is performed from a "Command Prompt" window run as administrator.


My question was not about if it was run as administrator.

I have a solution if you are trying to do this on one computer, but not a script solution.


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

Re: Dism /Apply-Image and completely remove the entire content of the directory

Posted: 13 Jan 2016 05:31
by foxidrive
balubeto wrote: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?


In the spirit of conversation, the why is because Administrator does not have full permissions as it did in older versions of Windows, and the how...

Google will show you, and if you reveal which folders you are processing then people will help you by searching also.

Re: Dism /Apply-Image and completely remove the entire content of the directory

Posted: 13 Jan 2016 05:42
by balubeto
foxidrive wrote:
balubeto wrote: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?


In the spirit of conversation, the why is because Administrator does not have full permissions as it did in older versions of Windows, and the how...

Google will show you, and if you reveal which folders you are processing then people will help you by searching also.


So, how can I do to remove this directory structure?

Thanks

Bye

takeown problem

Posted: 16 Jan 2016 11:44
by balubeto
Hi

I have Windows 10 v1511 Enterprise 64 bit with two Microsoft account.

From the Command Prompt (run as administrator), I tried to write

Code: Select all

 takeown /S localhost /U "<Microsoft_account_(E-Mail_Address)>" /P <User_password>" /F "<Directory_path>" /R /A /D Y
 


but I get the "Access Denied" error. Why?

Thanks

Bye

Re: Dism /Apply-Image and completely remove the entire content of the directory

Posted: 17 Jan 2016 04:24
by balubeto
If I write the net user command, the profile names of the Microsoft accounts are displayed.

If, however, I write

Code: Select all

takeown /S localhost /U "<Account_profile_name>" /P "<Password>" /F "<Directory_path>" /R /A /D Y


Windows indicates that this user does not exist.

Also, if I try to activate the hidden administrator

Code: Select all

net user Administrator /Active:yes

net user Administrator "<Password>"


and then I try to write

Code: Select all

takeown /S localhost /U Administrator /P "<Password>" /F "<Directory_path>" /R /A /D Y


Windows always indicates that this user does not exist.

So, how should I use the /U option of takeown?

Thanks

Bye