Skip to main content
added 189 characters in body
Source Link
harrymc
  • 1
  • 31
  • 579
  • 995

This PowerShell snippet sets the owner using the Set-Acl command:

$ACL = Get-Acl -Path "Folder1""Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion"
$User = New-Object System.Security.Principal.Ntaccount("TestUser1")
$ACL.SetOwner($User)
$ACL | Set-Acl -Path "Folder1""Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion"
Get-ACL -Path "Folder1""Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion"

You need to run this code as administrator.

Source : How to Use PowerShell to Manage Folder Permissions.

This PowerShell snippet sets the owner using the Set-Acl command:

$ACL = Get-Acl -Path "Folder1"
$User = New-Object System.Security.Principal.Ntaccount("TestUser1")
$ACL.SetOwner($User)
$ACL | Set-Acl -Path "Folder1"
Get-ACL -Path "Folder1"

You need to run this code as administrator.

Source : How to Use PowerShell to Manage Folder Permissions.

This PowerShell snippet sets the owner using the Set-Acl command:

$ACL = Get-Acl -Path "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion"
$User = New-Object System.Security.Principal.Ntaccount("TestUser1")
$ACL.SetOwner($User)
$ACL | Set-Acl -Path "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion"
Get-ACL -Path "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion"

You need to run this code as administrator.

Source : How to Use PowerShell to Manage Folder Permissions.

Source Link
harrymc
  • 1
  • 31
  • 579
  • 995

This PowerShell snippet sets the owner using the Set-Acl command:

$ACL = Get-Acl -Path "Folder1"
$User = New-Object System.Security.Principal.Ntaccount("TestUser1")
$ACL.SetOwner($User)
$ACL | Set-Acl -Path "Folder1"
Get-ACL -Path "Folder1"

You need to run this code as administrator.

Source : How to Use PowerShell to Manage Folder Permissions.