removing a file

Apr 2, 2011
1,584
14
55
North Carolina, USA
@rconn - great to see a post from you this AM. Hope all is well with you!

Permissions: I have edited the del_me.btm to issue a ICACLS as quoted here:

ACLs - not sure what that is - except for something in a person's body....

open files - not the case as all the files are a subset in c:\backup\....

system files: the files only have "A" attribute....... not "S"..... or am I missing something?

@Charles Dye - see my comment about file attributes above.....
 
May 20, 2008
12,035
127
Syracuse, NY, USA
This works.

1. Take ownership of the file (I did that manually)
2. use ICACLS to make yourself named among the principals (you're not, even if you own the file) ... AND WITH FULL ACCESS.

I used

Code:
c:\program files (x86)\common files\microsoft shared\dao> ICACLS dao360.dll /grant vefatica:F
processed file: dao360.dll
Successfully processed 1 files; Failed processing 0 files

3. Delete it.

I actually deleted the real thing (and restored it from a copy).
Code:
c:\program files (x86)\common files\microsoft shared\dao> del dao360.dll
Deleting C:\Program Files (x86)\Common Files\Microsoft Shared\DAO\dao360.dll
     1 file deleted

If you insist on doing this in a script, you'll have to figure out how to change ownership with a script. SUBINACL is pretty easy to find. Google turned up this example

Code:
subinacl /file test.txt /setowner=domain\user_id

And Windows 10 has TAKEOWN.EXE.

And ICACLS has a "/setowner" option.
 
May 20, 2008
12,035
127
Syracuse, NY, USA
I found another file owned by TrustedInstaller. I backed it up and did this (elevated).

Code:
v:\> takeown /f "c:\Program Files (x86)\Common Files\Microsoft Shared\ink\rtscom.dll"

SUCCESS: The file (or folder): "c:\Program Files (x86)\Common Files\Microsoft Shared\ink\rtscom.dll" now owned by user "JJ\vefatica".

v:\> ICACLS "c:\Program Files (x86)\Common Files\Microsoft Shared\ink\rtscom.dll" /grant vefatica:F
processed file: c:\Program Files (x86)\Common Files\Microsoft Shared\ink\rtscom.dll
Successfully processed 1 files; Failed processing 0 files

v:\> del "c:\Program Files (x86)\Common Files\Microsoft Shared\ink\rtscom.dll"
Deleting C:\Program Files (x86)\Common Files\Microsoft Shared\ink\rtscom.dll
     1 file deleted

Then I restored the file from the backup.
 

Similar threads