打印机访问掩码
Access Mask for printer
自从我弄乱访问掩码以来已经有一段时间了,我在网上找到了一个脚本,我可以根据自己的目的进行更改,但在这个脚本中,它将权限设置为管理文档 268435456
我需要将其转换为完全权限。关于我应该使用什么访问掩码的任何想法?部分代码如下:
# Give 'Users' the 'Manage Documents' permission:
$SecurityDescriptor.DiscretionaryAcl.AddAccess(
'Allow', # AccessControlType
([System.Security.Principal.NTAccount] 'stephen.lyons.sa').Translate(
[System.Security.Principal.SecurityIdentifier]
),
268435456, # AccessMask
'ContainerInherit, ObjectInherit', # InheritanceFlags
'InheritOnly' # PropagationFlags
.Net 在这方面没有问题,但是使用 built-in PoSH cmdlet 来处理这类事情要容易得多。
# Get parameters, examples, full and Online help for a cmdlet or function
(Get-Command -Name Get-Acl).Parameters
Get-help -Name Get-Acl -Examples
Get-help -Name Get-Acl -Full
Get-help -Name Get-Acl -Online
(Get-Command -Name Set-Acl).Parameters
Get-help -Name Set-Acl -Examples
Get-help -Name Set-Acl -Full
Get-help -Name Set-Acl -Online
Get-Help about_*
# All Help topics locations
explorer "$pshome$($Host.CurrentCulture.Name)"
Weekend Scripter: Use PowerShell to Get, Add, and Remove NTFS
Permissions Windows PowerShell Shell Permissions
This post introduces the NTFSSecurity module, which provides a bunch
of cmdlets for managing permissions on NTFS drives. It does not use
the Windows PowerShell way to access the file system, and it works
around the MAX_PATH, which is 260 characters. (For more information,
see Naming Files, Paths, and Namespaces). This is achieved thanks to
AlphaFS.
十进制268435456
(十六进制0x10000000
)是一种通用权限(GENERIC_ALL
或简称GA
),表示完全控制。通用权限之所以称为通用权限,是因为无论安全对象是什么,它们的含义都是一样的 - 是不同安全对象的缩写。
打印机权限比文件系统和注册表权限更棘手,因为 'documents' 似乎不仅仅是 'child containers' 或 'child objects'...相反,它们是两者的某种组合.
当我将该访问掩码应用于打印机并将其设置为仅应用于子对象和子容器时(就像您在示例中所做的那样),GUI 实际上会显示 Manage Documents
。
更具体地说...
如果您想获得超级特定的权限并使用 printer-specific 权限而不是通用权限,您可以添加两个具有这些访问掩码和标志的 ACE:
# AdministerJob, Delete, ReadJob, ChangePermissions, TakeOwnership
AccessMask: 983088 (hex 0x000F0030)
InheritanceFlags: ObjectInherit
PropagationFlags: InheritOnly
# ReadPermissions
AccessMask: 131072 (hex 0x00020000)
InheritanceFlags: ContainerInherit
PropagationFlags: InheritOnly
为了解决这个问题,我作弊并使用 GUI 设置 Manage Documents
正确,然后返回并使用命令行查看它。
“完全控制”呢?
不过,您问的是完全控制。如果我返回并使用第二种方法(在 GUI 中进行更改,然后查看安全描述符),我会看到这两个 ACE:
# PrinterFullControl
AccessMask: 983052 (hex 0x000F000C)
InheritanceFlags: None
PropagationFlags: None
# AdministerJob, Delete, ReadJob, ChangePermissions, TakeOwnership
AccessMask: 983088 (hex 0x000F0030)
InheritanceFlags: ObjectInherit
PropagationFlags: InheritOnly
试试这两个,看看 GUI 是否报告您正在寻找的内容。我使用 GUI 添加了一个选中了所有复选框的 ACE,所以如果这不是您想要的,可能需要进一步调整。
自从我弄乱访问掩码以来已经有一段时间了,我在网上找到了一个脚本,我可以根据自己的目的进行更改,但在这个脚本中,它将权限设置为管理文档 268435456
我需要将其转换为完全权限。关于我应该使用什么访问掩码的任何想法?部分代码如下:
# Give 'Users' the 'Manage Documents' permission:
$SecurityDescriptor.DiscretionaryAcl.AddAccess(
'Allow', # AccessControlType
([System.Security.Principal.NTAccount] 'stephen.lyons.sa').Translate(
[System.Security.Principal.SecurityIdentifier]
),
268435456, # AccessMask
'ContainerInherit, ObjectInherit', # InheritanceFlags
'InheritOnly' # PropagationFlags
.Net 在这方面没有问题,但是使用 built-in PoSH cmdlet 来处理这类事情要容易得多。
# Get parameters, examples, full and Online help for a cmdlet or function
(Get-Command -Name Get-Acl).Parameters
Get-help -Name Get-Acl -Examples
Get-help -Name Get-Acl -Full
Get-help -Name Get-Acl -Online
(Get-Command -Name Set-Acl).Parameters
Get-help -Name Set-Acl -Examples
Get-help -Name Set-Acl -Full
Get-help -Name Set-Acl -Online
Get-Help about_*
# All Help topics locations
explorer "$pshome$($Host.CurrentCulture.Name)"
Weekend Scripter: Use PowerShell to Get, Add, and Remove NTFS Permissions Windows PowerShell Shell Permissions
This post introduces the NTFSSecurity module, which provides a bunch of cmdlets for managing permissions on NTFS drives. It does not use the Windows PowerShell way to access the file system, and it works around the MAX_PATH, which is 260 characters. (For more information, see Naming Files, Paths, and Namespaces). This is achieved thanks to AlphaFS.
十进制268435456
(十六进制0x10000000
)是一种通用权限(GENERIC_ALL
或简称GA
),表示完全控制。通用权限之所以称为通用权限,是因为无论安全对象是什么,它们的含义都是一样的 - 是不同安全对象的缩写。
打印机权限比文件系统和注册表权限更棘手,因为 'documents' 似乎不仅仅是 'child containers' 或 'child objects'...相反,它们是两者的某种组合.
当我将该访问掩码应用于打印机并将其设置为仅应用于子对象和子容器时(就像您在示例中所做的那样),GUI 实际上会显示 Manage Documents
。
更具体地说...
如果您想获得超级特定的权限并使用 printer-specific 权限而不是通用权限,您可以添加两个具有这些访问掩码和标志的 ACE:
# AdministerJob, Delete, ReadJob, ChangePermissions, TakeOwnership
AccessMask: 983088 (hex 0x000F0030)
InheritanceFlags: ObjectInherit
PropagationFlags: InheritOnly
# ReadPermissions
AccessMask: 131072 (hex 0x00020000)
InheritanceFlags: ContainerInherit
PropagationFlags: InheritOnly
为了解决这个问题,我作弊并使用 GUI 设置 Manage Documents
正确,然后返回并使用命令行查看它。
“完全控制”呢?
不过,您问的是完全控制。如果我返回并使用第二种方法(在 GUI 中进行更改,然后查看安全描述符),我会看到这两个 ACE:
# PrinterFullControl
AccessMask: 983052 (hex 0x000F000C)
InheritanceFlags: None
PropagationFlags: None
# AdministerJob, Delete, ReadJob, ChangePermissions, TakeOwnership
AccessMask: 983088 (hex 0x000F0030)
InheritanceFlags: ObjectInherit
PropagationFlags: InheritOnly
试试这两个,看看 GUI 是否报告您正在寻找的内容。我使用 GUI 添加了一个选中了所有复选框的 ACE,所以如果这不是您想要的,可能需要进一步调整。