PSMSC042E Failed to create registry key [Software\Classes\CLSID] (System error [1021]: Cannot create a stable subkey under a volatile parent key.) (Codes: -1, 1021)
195
Created On 11/10/26 10:56 AM - Last Modified 11/10/26 12:57 PM
Symptom
PSM Session fails with these errors in the PSMTrace.log:
PSMSC001E Session common exception occurred. PSMSC042E Failed to create registry key [Software\Classes\CLSID] (System error [1021]: Cannot create a stable subkey under a volatile parent key.) (Codes: -1, 1021)
PSMSR009I Privileged Session Manager exception occurred. PSMSR519E [SessionID] Failed to map local drives for session [5] (Error: PSMSC042E Failed to create registry key [Software\Classes\CLSID] (System error [1021]: Cannot create a stable subkey under a volatile parent key.)) (Codes: -1, -1)
PSMSR370I [SessionID] Attempting to release mutex for shadow user [PSM-ShadowUser]
PSMSR523I Successfully released mutex for shadow user [SessionID]
Environment
10.1;10.2;10.3;10.4;10.5;10.6;10.7;10.8;10.9;14.2 Privileged Access Manager (PAM, self-hosted) PSM;Privileged Session Management (PSM) PSM
Cause
Possible corruption of the shadow user profile in windows.
Resolution
Forcing the default profile to have the key created:
1. Go to the affected PSM, open the regedit.
2. Step into HKEY_USERS
3. Click on File > Load Hive...
4. Search for the C:\Users\Default\ntuser.dat(This Default folder is Hidden.)
5. Name the loaded hive as TEST. This will create the HKEY_USERS\TEST.
6. Go to HKEY_USERS\TEST\SOFTWARE\ and create the missing RegKeys.
HKEY_USERS\TEST\SOFTWARE\CLSID and HKEY_USERS\TEST\SOFTWARE\CLASSES\CLSID
7. Then go to File > Unload the TEST hive.
8. Finally, delete the Shadow-User Windows profiles. Allow the profile to be recreated by another new session.
To delete shadowuser in bulk, you can reference to this script:
$SkipList = @('Administrator', 'DefaultAccount', 'Guest', 'WDAGUtilityAccount', 'PSMConnect', 'PSMAdminConnect')
Get-LocalUser | Where-Object {($_.Name -NotIn $SkipList) -and ($_.Name -Match 'PSM-') -and ($_.Name -inotmatch 'admin') -and ($_.Name -inotmatch 'user')} | Remove-LocalUser -WhatIf
*This script command is tested within my own lab. Please make sure that the "Get-LocalUser" command returns only accounts that you want to remove, before proceeding to execute the whole command.