PowerShell for Windows Admins

Jul 24 2010   7:29AM GMT

Remove Registry Key



Posted by: Richard Siddaway
PowerShell v2, Registry

Alternatively we can remove the whole key

001
002
003
004
005
006
007
008
$HKLM = 2147483650 #HKEY_LOCAL_MACHINE

$computer = "."  #local machine
$reg = [wmiclass]"\\$computer\root\default:StdRegprov"

$key = "SOFTWARE\ITKE PSAdmins"

$reg.DeleteKey($HKLM, $key)

We define the hive and the key and call the DeleteKey() method

Comment on this Post

Leave a comment: