Announcement

Collapse
No announcement yet.

Forcing file delete - Even when Trusted Installer owns the file.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Forcing file delete - Even when Trusted Installer owns the file.

    Anyone know how to force a file delete - Even when Trusted Installer owns the file?

    And in general - way to programatically change permissions and ownership.

  • #2
    This might be enough.
    https://answers.microsoft.com/en-us/...8-870a63d075c8

    Comment


    • #3
      Thanks Mike

      I am looking for a way to read and change "security" and "ownership" from inside a PB program. I'm sure there is some WIN API, I just need to find it.

      Comment


      • #4
        I imagine it is in here someplace:

        https://docs.microsoft.com/en-us/win...-access-rights
        or
        https://docs.microsoft.com/en-us/win...-access-rights

        I'll go read what MS says...


        Comment


        • #5
          You could start here:
          https://docs.microsoft.com/en-us/win...-access-rights

          Note this part:
          In most cases, the ability to read and write the security settings of a file or directory object is restricted to kernel-mode processes. Clearly, you would not want any user process to be able to change the ownership or access restriction on your private file or directory.

          Comment


          • #6
            Thanks Stuart, I will look at that.

            i'm working on a tool to eliminate duplicate image files. Some of the images are on backup drives from years ago. Some of them are owned by the trusted installer.

            Comment


            • #7
              If you are running under an admin context then one easy way is to shell out and use ICACLS.exe

              Being pedantic but as a reminder, your program MUST run under the context of a user with elevated admin rights to even attempt it, otherwise it will fail.

              Every so often, you will not be able to change the permissions / delete a file even as the admin. You might then need to use psexec to elevate your context to System account. (p.s. there are other ways outside of using psexec --- i.e., using AT)


              psexec -i -s yourprog.exe
              <b>George W. Bleck</b>
              <img src='http://www.blecktech.com/myemail.gif'>

              Comment


              • #8
                last resort
                copy what you want to keep, then format
                Dale

                Comment


                • #9
                  Thanks for the ideas guys!

                  I have ZILLIONS of old files. Copies of copies of copies.... Many are copies of entire disks OS and all. I am trying to only keep the "good" stuff. Have a nice md5 duplicate file flager so far..

                  Comment


                  • #10
                    Originally posted by David Clarke View Post
                    Thanks for the ideas guys!
                    I have ZILLIONS of old files. Copies of copies of copies.... Many are copies of entire disks OS and all..
                    I know the feeling
                    Everytime I've replace a laptop or desktop with still viable drive(s). I copy all of the working directories to the new machine but keep the drives and connect them with a USB caddy if I was to go back to them. So I've got several generations of MyDocuments, MyPIcitures, my "dev" directory trees etc. I really should clean then up and make a couple of TB of disk space avaiable for other things.






                    Comment

                    Working...
                    X