如何使用 PowerShell 删除注册表项值(属性)?

要使用 PowerShell 删除注册表项值,我们可以使用Remove-ItemProperty命令。假设我们有注册表NodeSoftware并且它的属性是AppSecurity。我们需要使用Remove-ItemProperty命令删除它的键。

PS C:\> Get-Item HKLM:\SOFTWARE\NodeSoftware

Hive: HKEY_LOCAL_MACHINE\SOFTWARE

Name    Property

----    --------

NodeSoftware    AppSecurity : 1

要删除注册表项,

PS C:\>Remove-ItemProperty HKLM:\SOFTWARE\NodeSoftware\ -Name AppSecurity -Force -Verbose

VERBOSE: Performing the operation "Remove Property" on target "Item: HKEY_LOCAL_MACHINE\SOFTWARE\NodeSoftware\ Property: AppSecurity".

您还可以通过设置位置来删除属性。例如,

示例

PS C:\> Set-Location HKLM:\SOFTWARE\NodeSoftware

PS HKLM:\SOFTWARE\NodeSoftware> Remove-ItemProperty -Path . -Name AppSecurity -Force -Verbose

要使用 Pipeline 删除 Item 属性,

Get-Item HKLM:\SOFTWARE\NodeSoftware | Remove-ItemProperty -Name AppSecurity -Force -Verbose

以上是 如何使用 PowerShell 删除注册表项值(属性)? 的全部内容, 来源链接: utcz.com/z/341455.html

回到顶部