Home > Net >  PowerShell: Set-Acl "SeSecurityPrivilege" authorization missing
PowerShell: Set-Acl "SeSecurityPrivilege" authorization missing

Time:10-21

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?

CodePudding user response:

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

  • Related