如何使用 PowerShell 删除注册表项值(属性)?
powershellmicrosoft technologiessoftware & coding
要使用 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
要使用管道删除 Item 属性,
Get-Item HKLM:\SOFTWARE\NodeSoftware | Remove-ItemProperty -Name AppSecurity -Force -Verbose

