Skip to main content

Remove-UserRegistryValue

Description

Remove specific registry values for all users.

Requirements

Only the parameters required by the script.

Usage

  1. Find all user profiles' usernames, SIDs, and locations of ntuser.dat files.
  2. Query against the hive for SIDs.
  3. Loop through the hive, loading it and removing the registry value at the specified path for the specified key if it exists.
  4. If it does not exist, write to the log.
  5. If not excluded, load the default user hive and remove the registry value at the specified path for the specified key if it exists.
  6. If it does not exist, write to the log.

Example

Explanation of the usage of the below example:

.\Remove-UserRegistryValue.ps1 -Path "path" -Keyname "keyname" -ExcludeDefault

Parameters

ParameterAliasRequiredDefaultTypeDescription
PathTrueStringPath following the SID to the specified key.
KeyNameTrueStringName of the specific key.
ExcludeDefaultFalseSwitchExcludes the default account when querying accounts.

Output

Location of output for log, result, and error files.

.\Remove-UserRegistryValue-log.txt