Announcement

Collapse
No announcement yet.

How do I Take Ownership of an existing file

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

  • How do I Take Ownership of an existing file

    In my SF9.5 project, I'm trying to take ownership of an existing file, so I can replace it with a different one. I know how to do it manually by going to File Properties, Security tab, Advanced, Owner tab, then Edit. But I'm not sure what processing in SF9.5 would allow me to do this. I have used and am slightly familiar with REGINI.EXE, if this is the way to do it, but I thought I'd make a post to see if there is a nice and easy way to do it in SF. Thanks, MikeT

  • #2
    I believe that there is no function built into Setup Factory for doing this, but you might be able to take ownership of a file or folder with the "takeown.exe" command, available in Windows since Vista. Hopefully you don't need to support Windows XP?

    Ulrich

    Comment


    • #3
      Thanks Ulrich. That worked well. Syntax I used was:

      -- Take Ownership of MyFile.exe[/COLOR]
      Shell.Execute(_SystemFolder.."\\takeown.exe", "open", "/F "..SessionVar.Expand("%AppFolder%\\MyFile.exe" ).." /A", "_SystemFolder..", SW_HIDE, true);
      -- Set Permissions for Administrators for Full Access.
      File.SetPermissions(SessionVar.Expand("%AppFolder% \\MyFile.exe"), SID_ADMINISTRATORS, SET_ACCESS, ALL_PERMISSIONS, SUB_CONTAINERS_AND_OBJECTS_INHERIT);

      Comment

      Working...
      X