PowerShell registry key related

Last updated:

WINDOWSPOWERSHELL

Get single key

Get-ItemProperty -Path HKLM:\Software\Microsoft\Windows\CurrentVersion -Name DevicePath -Name DevicePath

## or
(Get-ItemProperty -Path HKLM:\Software\Microsoft\Windows\CurrentVersion).DevicePath

Delete key

Remove-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion -Name PSHome
Remove-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion -Name PowerShellPath


> $Path = 'HKLM:\SYSTEM\ControlSet001\Control\Session Manager\Environment'
> Remove-ItemProperty -Path $Path -Name Cloud_Setting_repositories

references:

Working with registry entries - PowerShell | Microsoft Learn