Windows PowerShell for Administration: The Personal Trainer by Stanek William

Windows PowerShell for Administration: The Personal Trainer by Stanek William

Author:Stanek, William
Language: eng
Format: epub
Publisher: Stanek & Associates
Published: 2015-07-01T04:00:00+00:00


Deleting Registry Keys and Values

You can delete registry keys using the Remove-Item cmdlet. Remove-Item has the following syntax

remove-item NamePath [-Force]

where NamePath is the full path to the registry key that you want to remove, and –Force is an optional parameter to force the removal of the key. In the following example, you delete the HKCU:\Software\Test2 key (and all its contents):

remove-item hkcu:\software\test2

As long as you have the appropriate permissions, you should be able to remove registry keys.

You can delete key values using the Remove-ItemProperty cmdlet. Remove-ItemProperty has the following syntax

remove-itemproperty [-Path] KeyPath [-Name] ValueName [-Force]

where KeyPath is the full path to the registry key that contains the value you want to remove, ValueName is the name of the value to remove, and –Force is an optional parameter to force the removal of the key value. In the following example, you delete the Data value for the HKCU:\Software\Test key:

remove-itemproperty –path hkcu:\software\test –name data

As long as you have the appropriate permissions, you should be able to remove key values.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.