Exception calling "SetAccessRule" with "1" argument(s): "Some or all identity references could not be translated."

  acl, active-directory, identity, powershell, windows

I try to give full access to normal users by using this script. This PowerShell script is perfectly working in My machine. But it is not working in Other machines. Below mentioned powershell script.

$key = [Microsoft.Win32.Registry]::LocalMachine.OpenSubKey("SOFTWAREWow6432NodeUnicorn",[Microsoft.Win32.RegistryKeyPermissionCheck]::ReadWriteSubTree,[System.Security.AccessControl.RegistryRights]::ChangePermissions)
$acl = $key.GetAccessControl()
$rule = New-Object System.Security.AccessControl.RegistryAccessRule (".USERS","FullControl",@("ObjectInherit","ContainerInherit"),"None","Allow")

Write-Host "Successfully set permission to PM Registry!"

Here I attached error message also.

error message

Source: Windows Questions