Skip to content

Commit aff5239

Browse files
committed
PSModules: Protect-Path uses icacles
cacls.exe is deprecated, and should be replaced with icacls. Signed-off-by: Julian Hjortshoj <[email protected]>
1 parent c950480 commit aff5239

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

modules/BOSH.Utils/BOSH.Utils.psm1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
icacls.exe $path /grant "Administrators:(OI)(CI)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+
icacls.exe $path /remove "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+
icacls.exe $path /remove "BUILTIN\IIS_IUSRS"
156156
if ($LASTEXITCODE -ne 0)
157157
{
158158
Throw "Error setting ACL for $path exited with $LASTEXITCODE"

0 commit comments

Comments
 (0)