Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Steven Wilber 103 posts 98 karma points
    Dec 13, 2010 @ 15:18
    Steven Wilber
    0

    Permissions in Windows Server 2008

    Hi all,

    I'm just upgrading all our servers to Windows Server 2008 and for some reason Microsoft has chosen to not allow security to be set via the UI for more than one folder at a time - curses! Since I have dozens of sites to migrate I needed to find a quick way that I thought that I would share.

    Basically I utilised the CACLS command and wrapped up all the permissioning into a .CMD file that I placed on the desktop. Then using the %1 in the CMD file, i.e. the name of the first argument passed I set all the permissions. If you drag a file/folder over the file, then it's full path becomes the first argument. Thus to set all the permissions that I need I just drag the parent folder over the .CMD file and it is all done.

    The contents of the .CMD file is as below. You may need to change this depending on your server setup.

    So, for each new website, I create the folder, unzip Umbraco into the folder and then just drag and drop the website folder over the .CMD on the desktop and Robert is your uvuncular relative. Simples.

    Cheers

    Steve

     

    @Echo Off

    :Loop
    If [%1]==[] Goto Continue
       Echo Setting permissions on: "%1"

       CACLS "%1" /T /E /C /P "IUSR":R
       CACLS "%1" /T /E /C /P "NETWORK SERVICE":R
       CACLS "%1" /T /E /C /P "IIS_IUSRS":R

       CACLS "%1\app_data" /T /E /C /P "IUSR":C
       CACLS "%1\css" /T /E /C /P "IUSR":C
       CACLS "%1\data" /T /E /C /P "IUSR":C
       CACLS "%1\masterpages" /T /E /C /P "IUSR":C
       CACLS "%1\media" /T /E /C /P "IUSR":C
       CACLS "%1\scripts" /T /E /C /P "IUSR":C
       CACLS "%1\xslt" /T /E /C /P "IUSR":C
       CACLS "%1\web.config" /T /E /C /P "IUSR":C

       CACLS "%1\app_data" /T /E /C /P "NETWORK SERVICE":C
       CACLS "%1\css" /T /E /C /P "NETWORK SERVICE":C
       CACLS "%1\data" /T /E /C /P "NETWORK SERVICE":C
       CACLS "%1\masterpages" /T /E /C /P "NETWORK SERVICE":C
       CACLS "%1\media" /T /E /C /P "NETWORK SERVICE":C
       CACLS "%1\scripts" /T /E /C /P "NETWORK SERVICE":C
       CACLS "%1\xslt" /T /E /C /P "NETWORK SERVICE":C
       CACLS "%1\web.config" /T /E /C /P "NETWORK SERVICE":C

       CACLS "%1\app_data" /T /E /C /P "IIS_IUSRS":C
       CACLS "%1\css" /T /E /C /P "IIS_IUSRS":C
       CACLS "%1\data" /T /E /C /P "IIS_IUSRS":C
       CACLS "%1\masterpages" /T /E /C /P "IIS_IUSRS":C
       CACLS "%1\media" /T /E /C /P "IIS_IUSRS":C
       CACLS "%1\scripts" /T /E /C /P "IIS_IUSRS":C
       CACLS "%1\xslt" /T /E /C /P "IIS_IUSRS":C
       CACLS "%1\web.config" /T /E /C /P "IIS_IUSRS":C
    Shift
    Goto Loop
    :Continue
    @pause

Please Sign in or register to post replies

Write your reply to:

Draft