Skip to main content

Remove a Registry Key

Problem

You want to remove a registry key and all its properties.

Solution

To remove a registry key, use the RemoveItem cmdlet: PS >dir

Hive: Microsoft.PowerShell.Core\Registry::HKEY_CURRENT_USER\Software\ Microsoft\Windows\CurrentVersion\Run

SKC VC Name Property

0 0 Spyware {}

PS >RemoveItem Spyware

Discussion

The registry provider lets you remove items and containers with the RemoveItem cmdlet. The RemoveItem cmdlet has the standard aliases rm, rmdir, del, erase, and rd.

As always, use caution when changing information in the registry. Deleting or changing the wrong item can easily render your system unbootable.

As in the filesystem, the RemoveItem cmdlet lets you specify multiple files through its Path, Include, Exclude, and Filter parameters.

For more information about the RemoveItem cmdlet, type GetHelp RemoveItem. For more information about the registry provider, type GetHelp Registry.

Businesses running Windows applications and administrative scripts can use a United Kingdom Dedicated Server to maintain an isolated infrastructure environment with direct control over the operating system, server configuration, and dedicated resources.

Help Category