PowerShell 简述参数类型#yyds干货盘点#
环境配置说明
Windows 21H1
PSVersion 5.1.19041.1320
示例
以Set-Acl为例,简述参数类型
PS C:\Users\admin> Get-Help Set-Acl
名称
Set-Acl
摘要
Changes the security descriptor of a specified item, such as a file or a registry key.
语法
Set-Acl [-Path] [-AclObject] [[-CentralAccessPolicy] ] [-ClearCentralAccessPolicy] [-Exclude ] [-Filter ] [-Include ] [-Passthru] [-UseTransaction] [-Confirm] [-WhatIf] []
Set-Acl [-AclObject] [[-CentralAccessPolicy] ] [-ClearCentralAccessPolicy] [-Exclude ] [-Filter
] [-Include ] -LiteralPath [-Passthru] [-UseTransaction] [-Confirm] [-WhatIf] []
Set-Acl [-InputObject] [-AclObject] [-Exclude ] [-Filter ] [-Include ] [-Passthru] [-UseTransaction] [-Confirm] [-WhatIf] []
说明
The `Set-Acl` cmdlet changes the security descriptor of a specified item, such as a file or a registry key, to match the values in a security de
scriptor that you supply.
To use `Set-Acl`, use the Path or InputObject parameter to identify the item whose security descriptor you want to change. Then, use the AclObje
ct or SecurityDescriptor parameters to supply a security descriptor that has the values you want to apply. `Set-Acl` applies the security descri
ptor that is supplied. It uses the value of the AclObject parameter as a model and changes the values in the item's security descriptor to match
the values in the AclObject parameter.
相关链接
Online Version: https://docs.microsoft.com/powershell/module/microsoft.powershell.security/set-acl?view=powershell-5.1&WT.mc_id=ps-gethelp
Get-Acl
FileSystemAccessRule
ObjectSecurity.SetAccessRuleProtection
FileSystemRights
备注
若要查看示例,请键入: "get-help Set-Acl -examples".
有关详细信息,请键入: "get-help Set-Acl -detailed".
若要获取技术信息,请键入: "get-help Set-Acl -full".
有关在线帮助,请键入: "get-help Set-Acl -online"
参数类型简介
* Set-Acl 提供三种参数集,每次只能使用其中的一种。
* [-Path] :必选参数
* [-Path]: 可以不写 -Path 这几个字符
* : 必须要传入参数的类型
* [-Exclude ]:可选参数,如果要使用,就必须写参数的名称
* [[-CentralAccessPolicy] ]:可选的位置参数,必须在正确的位置
* [-Passthru]:可选的SwitchParameter
* [] :可选的通用参数
Get-Help -Full 查看参数的详细解释
PS C:\Users\admin> Get-Help Set-Acl -Full
-Path
Changes the security descriptor of the specified item. Enter the path to an item, such as a path to a file or registry key. Wildcards are pe
rmitted.
If you pass a security object to `Set-Acl` (either by using the AclObject or SecurityDescriptor parameters or by passing a security object f
rom Get-Acl to `Set-Acl`), and you omit the Path parameter (name and value), `Set-Acl` uses the path that is included in the security object
.
是否必需? True
位置? 0
默认值 None
是否接受管道输入? True (ByPropertyName)
是否接受通配符? True
-Exclude
Omits the specified items. The value of this parameter qualifies the Path parameter. Enter a path element or pattern, such as `*.txt`. Wildc
ards are permitted.
是否必需? False
位置? named
默认值 None
是否接受管道输入? False
是否接受通配符? True
-CentralAccessPolicy
Establishes or changes the central access policy of the item. Enter the CAP ID or friendly name of a central access policy on the computer.
Beginning in Windows Server 2012, administrators can use Active Directory and Group Policy to set central access policies for users and grou
ps. For more information, see Dynamic Access Control: Scenario Overview (/windows-server/identity/solution-guides/dynamic-access-control--sc
enario-overview).
This parameter was introduced in Windows PowerShell 3.0.
是否必需? False
位置? 2
默认值 None
是否接受管道输入? True (ByPropertyName)
是否接受通配符? False
-Passthru
Returns an object that represents the security descriptor that was changed. By default, this cmdlet does not generate any output.
是否必需? False
位置? named
默认值 False
是否接受管道输入? False
是否接受通配符? False
此 Cmdlet 支持常见参数: Verbose、Debug、
ErrorAction、ErrorVariable、WarningAction、WarningVariable、
OutBuffer、PipelineVariable 和 OutVariable。有关详细信息,请参阅
about_CommonParameters (CommonParameters是指什么
学习资料
PowerShell 版本 + 工具
PowerShell/PowerShell
51CTO社区
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
暂时没有评论,来抢沙发吧~