Announcement

Collapse
No announcement yet.

Granting folder permssions

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

  • Granting folder permssions

    What is the correct way to do this please?

    Folder.SetPermissions(SessionVar.Expand("%TempLaun chFolder%"), "NT AUTHORITY\\NETWORK SERVICE", "Grant", "Full control", true);

    Thank you!
    Eliezer

  • #2
    I realize that the code I pasted above will not work. It's from an older thread on the forums. I tried downloading that zip file but it doesn't seem compatible with SUF 9.5.

    In any case, I don't mind using the long-hand version of the code. But I don't know how to do that... If someone could please provide any version of the code (long, short, or otherwise) I'd be most grateful.

    Thanks again,
    Eliezer

    Comment


    • #3
      In Setup Factory 9, you can use File.SetPermissions() to set permissions on files and folders. However, if you follow the instructions, the method with the external script should also work - most likely you missed something.

      Ulrich

      Comment


      • #4
        Ulrich, thank you very much.
        When I tried to install the EXE from that older thread, I got stuck at the installer. It wouldn't take the 9.5 path for the 8.0 one that it was looking for.

        In any case, I didn't know about the File.SetPermissions. It's missing from the documentation. Accordingly, I'm kind of guessing. How would I know the SID for the NETWORK SERVICE? Might it not change? I'm trying to grant full control. What do I need to change here?
        File.SetPermissions(SessionVar.Expand("%TempLaunch Folder%"), SID, ACCESS_ALL, ALL_PERMISSIONS, SUB_CONTAINERS_AND_OBJECTS_INHERIT);

        Thank you again,
        Eliezer

        Comment


        • #5
          Originally posted by Eliezer View Post
          In any case, I didn't know about the File.SetPermissions. It's missing from the documentation.
          It is certainly not missing. It is available in the online docs, in the intellisense-like autocomplete, in the CHM... Please look carefully. The link you posted is from the Visual Patch documentation, not the Setup Factory help file. The documentation is there, well written, with examples as always, and there is no need to guess anything.

          Click image for larger version

Name:	SCRN-2015-05-27-01.png
Views:	1
Size:	6.6 KB
ID:	284313

          You can find well known SIDs here. I am not sure that you can use the Network Service in this manner, though.

          Ulrich

          Comment


          • #6
            My apologies; you're correct. Thank you for your help!

            Comment

            Working...
            X