It will work. for the improvement add below line instead of icacls $Folder /grant "Users:(OI)(CI)M" /T /C this.
icacls $Folder /grant:r "Users:(OI)(CI)M" /T /C
Thanks.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
$Folders = @(
2
"C:\ProgramData\Tally",
3
"C:\Program Files\Tally.ERP9",
4
"C:\Program Files (x86)\Tally.ERP9"
5
)
6
7
foreach ($Folder in $Folders) {
8
if (Test-Path $Folder) {
9
Write-Output "Granting access to $Folder"
10
icacls $Folder /grant "Users:(OI)(CI)M" /T /C
11
}
12
else {
13
Write-Output "$Folder not found"
14
}
15
}
It will work. for the improvement add below line instead of icacls $Folder /grant "Users:(OI)(CI)M" /T /C this.
icacls $Folder /grant:r "Users:(OI)(CI)M" /T /C
Thanks.