Skip to content

Josh's IT-Blog

Information Technology, and other interesting things …

  • Home
  • About
  • Contact
  • Links
  • Home
  • About
  • Contact
  • Links

Volatile Registry Keys

  1. Home   »  
  2. Volatile Registry Keys

Volatile Registry Keys

6. November 20206. November 2020 Burkard JoshGeneralTagged PowerShell

this days I had an issue, where a registry key was missing after a reboot. the registry key was created by an third party software and was needed by an other software part to function well. I created the registry key manually using Powershell or the Registry Editor, and the registry key wasn’t removed.

My workmates and I investigated several hours, for any software or scripts which removes this registry key on the next reboot.

now I found out, that the original software creates the registry key as “volatile” key. Volatile registry keys aren’t saved to the registry database, and lives only inside the memory. As soon, the computer is shutdown, all volatile registry keys are lost. You can’t see this in any built-in Windows GUI or by a default PowerShell CmdLet.

the only way, I found to check this is:

$hklm = [Microsoft.Win32.RegistryKey]::OpenBaseKey('LocalMachine','default')

# creates a volatile registry key
$a = $hklm.OpenSubKey('Software', $true)
$a.CreateSubKey('Test', $true , [Microsoft.Win32.RegistryOptions]::Volatile)

# load a registry key
$b = $hklm.OpenSubKey('SOFTWARE\Test', $true)

# test a registry key is volatile by creating a stable key --> fails if parent is volatile
try {
    $b.CreateSubKey('Test-Not-Volatile', $true , [Microsoft.Win32.RegistryOptions]::None)
    $KeyIsVolatile = $false
    # remove the temporary key again
    $b.DeleteSubKeyTree('Test-Not-Volatile')
}
catch {
    $KeyIsVolatile = $true
}
return $KeyIsVolatile

don’t forget to remove the test keys, when it’s false

Post navigation

Previous: change SCOM agent assignement to other SCOM gateway
Next: Stopping a hanging SCCM Task Sequence

About

Author Image
My name is Josh Burkard.
I'm a DevOps Engineer working with one of Europees largest payroll provider. in my work I have a lot to do with Microsoft server operating systems, System Center, VMware, Microsoft Azure Cloud and other software.
On this site I will write some posts about different technology problems and their solutions.
please note also my tweets and retweets from this area.

Categories

  • General (13)
  • Hardware (9)
    • Network (8)
      • Cisco (2)
    • Storage (2)
  • Hiking (1)
  • Home Assistant (5)
  • Microsoft Azure (1)
    • Automation (1)
  • PowerShell (3)
  • Software (1)
    • Excel (1)
  • System Center (18)
    • SCCM (3)
    • SCDPM (1)
    • SCOM (12)
    • SCSM (1)
    • SMA (1)
  • VMware (8)
  • Windows 2008 R2 (10)
    • Active Directory (7)
  • Windows 2012 R2 (1)
  • Windows 2016 (1)
  • Windows 7 (4)
    • BitLocker (1)
  • WordPress (1)
Proudly powered by WordPress | Theme: goldy-mex by inverstheme.