locked
PS Error: set acl sec idnt is not allowed to be the owner of this object RRS feed

  • Question

  • Hello, 

    II receive following error in my sript: "set acl The security identifier is not allowed to be the owner of this object"

    My script:

    $name = Read-Host -Prompt "Enter Userame"
    $user = "Domain\"  + $name
    $path = "E:\Pictures" 
    $path
    if(Test-Path $path){Write-Host 
    $Rights = "Read, ReadAndExecute, ListDirectory" 
    $InheritSettings = "Containerinherit, ObjectInherit" #Controls how permissions are inherited by children
    $PropogationSettings = "None" #Usually set to none but can setup rules that only apply to children.
    $RuleType = "Allow" #Allow or Deny.
    $acl = Get-Acl $path
    $acl.SetAccessRuleProtection($True, $True)
    $perm = $user, $Rights, $InheritSettings, $PropogationSettings, $RuleType
    $rule = New-Object -TypeName System.Security.AccessControl.FileSystemAccessRule -ArgumentList $perm
    $acl.SetAccessRule($rule)
    $acl | Set-Acl -Path $path
    Write-Host -ForegroundColor Green "OK!"
    } else {write-host "Not ok"}
    #########################################
    The E: drive is a mounted vhdx. I checked the drive owner - "the current owner cannot be displayed"

    I'll be thankful for helping me out.


    Friday, April 26, 2019 10:20 AM

All replies

  • You will have to be running as an elevated admin to do any of this.

    If the security descriptors are corrupt you will have to repair the drive the VHDX is stored on or reapirteh VHDX file.

    In either case this is not a scripting issue. 


    \_(ツ)_/

    Friday, April 26, 2019 11:02 AM
  • Hi,

    Was your issue resolved?

    If you resolved it using our solution, please "mark it as answer" to help other community members find the helpful reply quickly.

    If you resolve it using your own solution, please share your experience and solution here. It will be very beneficial for other community members who have similar questions.

    If no, please reply and tell us the current situation in order to provide further help.

    Best Regards,

    Lee


    Just do it.

    Tuesday, April 30, 2019 6:38 AM