Powershell: Set-Acl "Sesecurityprivilege" Authorization Missing

I have a PowerShell script which should change the permissions of a file:

param([string] $Path)\
$Berechtigung = Get-ACL -Path $Path\
$Berechtigung.SetAccessRuleProtection($true, $true)\
$NEUBerechtigung = New-Object System.Security.AccessControl.FileSystemAccessRule(“TEST\Domain-users”,”Read,ReadAndExecute”,”Allow”)\
$Berechtigung.SetAccessRule($NEUBerechtigung)\
$Berechtigung | Set-Acl -Path $Path

The PowerShell script is getting started with a batch-file which is passing a data-path to the script and runs it as an administrator:

PowerShell.exe -NoProfile -File .\Powershell_komplett.ps1 -path ""C:\_TEST\Erlaubt.txt""\
PowerShell.exe -Command "& {Start-Process PowerShell.exe -ArgumentList '-ExecutionPolicy Bypass -File ""C:\_TEST\Powershell_komplett.ps1""' -Verb RunAs}"

When I execute the batch-file I get the following error:

The process does not possess the 'SeSecurityPrivilege' privilege which is required for this operation.

How can I bypass this?

1

1 Answer

I wanted to restrict a group's access to a file but I was in the group myself. Since I am also an administrator on my device, I have full access to the file and therefore nothing has changed for me. So I added a group that I myself am not a member of and then it worked. Thanks for your help

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Maya Lin-Takahashi

Maya Lin-Takahashi

Consumer Tech & Gadget Reviewer

Maya is a hardware enthusiast who tests and reviews smart home devices, smartphones, wearables, and audio gear. She focuses on practical consumer value and build quality.

Share this article
Twitter Facebook Pinterest