Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

ICACLS WITH POWERHSELL

$
0
0

Dear All,

I am trying to assign permissions in Add mode to certain folders with powershell + ICACLS ,wherein read the data from a CSV and apply the permissions. Iam trying:

Here i have a input CSV file as below:

########################################################################################

file                                                                       account                                                                  permission                                                              
----                                                                       -------                                                                  ----------                                                              
c:\powershell                                                              archit1                                                                  F                                                                       
c:\users                                                                   archit1                                                                  F                                                                       
C:\test                                                                    archit1                                                                  F                                                           

######################################################################################################

$a=Import-Csv abc.csv
foreach($b in $a){
$file = $b.file
$account= $b.account
$permission= $b.permission
icacls $file /grant $account: $permission
}

but i am not able to perform it . i am getting :

icacls.exe : Invalid parameter "F"
At line:9 char:7
+ icacls <<<<  $file /grant $account: $permission
    + CategoryInfo          : NotSpecified: (Invalid parameter "F":String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

Any help would be appreciated :) 

Thanks,

Archit



Viewing all articles
Browse latest Browse all 15028

Trending Articles