Skip to content

Commit 88f2997

Browse files
committed
switch to icacls
1 parent 79bbdec commit 88f2997

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

modules/BOSH.Utils/BOSH.Utils.psm1

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,21 +101,21 @@ function Protect-Dir
101101
)
102102

103103
Write-Log "Protect-Dir: Grant Administrator"
104-
cmd.exe /c cacls.exe $path /T /E /P Administrators:F
104+
cmd.exe /c icacls.exe $path /T /grant:r Administrators:F
105105
if ($LASTEXITCODE -ne 0)
106106
{
107107
Throw "Error setting ACL for $path exited with $LASTEXITCODE"
108108
}
109109

110110
Write-Log "Protect-Dir: Remove BUILTIN\Users"
111-
cmd.exe /c cacls.exe $path /T /E /R "BUILTIN\Users"
111+
cmd.exe /c icacls.exe $path /T /remove:g "BUILTIN\Users"
112112
if ($LASTEXITCODE -ne 0)
113113
{
114114
Throw "Error setting ACL for $path exited with $LASTEXITCODE"
115115
}
116116

117117
Write-Log "Protect-Dir: Remove BUILTIN\IIS_IUSRS"
118-
cmd.exe /c cacls.exe $path /T /E /R "BUILTIN\IIS_IUSRS"
118+
cmd.exe /c icacls.exe $path /T /remove:g "BUILTIN\IIS_IUSRS"
119119
if ($LASTEXITCODE -ne 0)
120120
{
121121
Throw "Error setting ACL for $path exited with $LASTEXITCODE"
@@ -138,21 +138,21 @@ function Protect-Path
138138
)
139139

140140
Write-Log "Protect-Path: Grant Administrator"
141-
cmd.exe /c cacls.exe $path /E /P Administrators:F
141+
cmd.exe /c icacls.exe $path /grant:r Administrators:F
142142
if ($LASTEXITCODE -ne 0)
143143
{
144144
Throw "Error setting ACL for $path exited with $LASTEXITCODE"
145145
}
146146

147147
Write-Log "Protect-Path: Remove BUILTIN\Users"
148-
cmd.exe /c cacls.exe $path /E /R "BUILTIN\Users"
148+
cmd.exe /c cacls.exe $path /remove:g "BUILTIN\Users"
149149
if ($LASTEXITCODE -ne 0)
150150
{
151151
Throw "Error setting ACL for $path exited with $LASTEXITCODE"
152152
}
153153

154154
Write-Log "Protect-Path: Remove BUILTIN\IIS_IUSRS"
155-
cmd.exe /c cacls.exe $path /E /R "BUILTIN\IIS_IUSRS"
155+
cmd.exe /c cacls.exe $path /remove:g "BUILTIN\IIS_IUSRS"
156156
if ($LASTEXITCODE -ne 0)
157157
{
158158
Throw "Error setting ACL for $path exited with $LASTEXITCODE"

0 commit comments

Comments
 (0)