Hkey_current_user volatile environment

While working on an upcoming short article and the new utility it will introduce, I had the need to produce volatile Registry tricks. If you’re not acquainted with them, volatile tricks explode once disturbed … simply kidding, they’re secrets that just exist in memory and are never before stored in their equivalent hive file, i.e. they disappear as quickly as their hive is unloaded, frequently at logoff in the case of user keys and at shutdvery own or rebegin in the case of machine keys. Windows provides them in a number of areas, frequently to keep session-certain information that won’t necessarily apply to future sessions and therefore are best not made persistent. Problem was, neither Regmodify.exe nor Reg.exe (nor as much as I deserve to figure out PowerShell) deserve to create volatile tricks, not also subtricks of existing volatile secrets. For example, as presented in this screenshot, trying to create a subessential of the well-known volatile essential “HKCUVolatile Environment”, where session-specific atmosphere variables are stored, using Regmodify falls short (through a not specifically indevelopmental error message) bereason volatile tricks cannot have non-volatile subkeys, the just kind Regmodify can produce.

You watching: Hkey_current_user volatile environment

*

I therefore whipped up the quick little bit command line energy VolatileKey to create volatile keys. You deserve to acquire the latest variation of the energy straight from my github repo here: https://github.com/CCOSTAN/BlogPostStorageIt supplies no syntax assist, so all the vital intake information follows:

Syntax: VolatileKey.exe RootKey Subkey_Path, where RootKey should be one of HKCU, HKLM or HKU (or of their complete names HKEY_CURRENT_USER, and so on.), case-insensitive.

See more: Feature Update To Windows 10, Version 1803

Example: VolatileKey HKCU "SoftwareVolKeyVol Subkey"When the utility creates multiple new subsecrets in one go, as in the instance, they’ll all be volatile, so if you need some initial percentage of the subvital course to consist of “normal” (non-volatile) keys, pre-create that part of the subvital path making use of Reg.exe or other devices prior to invoking VolatileKey.exe.Once a volatile vital is developed, you can usage normal devices (Regmodify, Reg, PowerShell, etc.) to populate it with values.The utility provides return code (ErrorLevel) 0 to report success, 99 for incorrect syntaxes (fewer or even more than precisely two arguments, or an initial dispute that doesn’t complement one of the six enabled root crucial names), and also a typical Windows error code otherwise (which deserve to be understood by running NET HELPMSG #), for instance 5 = Access Denied.Note that subkeys (volatile or otherwise) cannot be developed straight under HKLM and also HKU – among their hive subkeys need to be specified, for example HKLMSoftware… or HKUuser_SID…Finally, the utility is compiled 32-bits, however can accessibility the complete 64-bit Registry view on x64 platcreates, so no 64-little bit version is offered or vital.Carlo, our intrepid blogunderstand, insists on use cases being presented when introducing a brand-new utility, and I admit he had actually me stumped on this one, yet here’s what involves mind: a volatile crucial can be provided as a “scratchpad” of sorts for scripts to keep track of their tasks in the course of a session, to quietly return results, or to pass information to cooperating scripts. The beauty of a volatile crucial for these purposes is that it’s guaranteed to be gone in a future session, plus utilizing one for scratchpad information is faster, even more convenient, and even more elegant than creating to a temporary file (that you may then need to delete at some point). Bottom line, though, I think this utility ssuggest plugs a hole in the scripter’s toolkit — whatever before the purpose, it should be possible to easily create volatile keys without having to rekind to API calls, and I was surprised not to find a tool that does it, … and we now have actually one.

See more: Hkey_Local_Machine Software Microsoft Windows Currentversion Internet Settings

That’s it for now. Stay tuned to this room for the following utility: I’m pretty certain you’ll prefer it.

JB

To stay up on Citrix and Microsoft ramblings among other things, be sure to follow Jacques on twitter: