Need to run Icacls command on multiple servers RRS feed

  • Question

  • Hi

    I have a text file with the list of servers and it is called servers.txt and I want to run the below command on all the drives on all the servers in that text file. 

    icacls folder1 /T /Grant "domain\user1:F"

    Can you please give me a sample Powershell script to do it


    Saturday, June 14, 2014 3:35 AM


  • Something like this (not tested):

    get-content serverlist.txt | foreach-object {
      icacls "\\$_\sharename\directoryname" /grant "domain\user1:F"

    -- Bill Stewart [Bill_Stewart]

    Saturday, June 14, 2014 3:43 AM