{"action":"closed","issue":{"url":"https://api.github.com/repos/PSAppDeployToolkit/PSAppDeployToolkit/issues/30","labels_url":"https://api.github.com/repos/PSAppDeployToolkit/PSAppDeployToolkit/issues/30/labels{/name}","comments_url":"https://api.github.com/repos/PSAppDeployToolkit/PSAppDeployToolkit/issues/30/comments","events_url":"https://api.github.com/repos/PSAppDeployToolkit/PSAppDeployToolkit/issues/30/events","html_url":"https://github.com/PSAppDeployToolkit/PSAppDeployToolkit/issues/30","id":75329409,"number":30,"title":"Invoke-HKCURegistrySettingsForAllUsers failing to unload Default-User profile","user":{"login":"appPackager","id":12298202,"avatar_url":"https://avatars.githubusercontent.com/u/12298202?v=3","gravatar_id":"","url":"https://api.github.com/users/appPackager","html_url":"https://github.com/appPackager","followers_url":"https://api.github.com/users/appPackager/followers","following_url":"https://api.github.com/users/appPackager/following{/other_user}","gists_url":"https://api.github.com/users/appPackager/gists{/gist_id}","starred_url":"https://api.github.com/users/appPackager/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/appPackager/subscriptions","organizations_url":"https://api.github.com/users/appPackager/orgs","repos_url":"https://api.github.com/users/appPackager/repos","events_url":"https://api.github.com/users/appPackager/events{/privacy}","received_events_url":"https://api.github.com/users/appPackager/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/PSAppDeployToolkit/PSAppDeployToolkit/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/PSAppDeployToolkit/PSAppDeployToolkit/labels/resolved","name":"resolved","color":"009800"}],"state":"closed","locked":false,"assignee":{"login":"mmashwani","id":5581235,"avatar_url":"https://avatars.githubusercontent.com/u/5581235?v=3","gravatar_id":"","url":"https://api.github.com/users/mmashwani","html_url":"https://github.com/mmashwani","followers_url":"https://api.github.com/users/mmashwani/followers","following_url":"https://api.github.com/users/mmashwani/following{/other_user}","gists_url":"https://api.github.com/users/mmashwani/gists{/gist_id}","starred_url":"https://api.github.com/users/mmashwani/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmashwani/subscriptions","organizations_url":"https://api.github.com/users/mmashwani/orgs","repos_url":"https://api.github.com/users/mmashwani/repos","events_url":"https://api.github.com/users/mmashwani/events{/privacy}","received_events_url":"https://api.github.com/users/mmashwani/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/PSAppDeployToolkit/PSAppDeployToolkit/milestones/4","html_url":"https://github.com/PSAppDeployToolkit/PSAppDeployToolkit/milestones/v3.6.4","labels_url":"https://api.github.com/repos/PSAppDeployToolkit/PSAppDeployToolkit/milestones/4/labels","id":1073609,"number":4,"title":"v3.6.4","description":"Issues and enhancements requests targeted for v3.6.4 of the toolkit.","creator":{"login":"mmashwani","id":5581235,"avatar_url":"https://avatars.githubusercontent.com/u/5581235?v=3","gravatar_id":"","url":"https://api.github.com/users/mmashwani","html_url":"https://github.com/mmashwani","followers_url":"https://api.github.com/users/mmashwani/followers","following_url":"https://api.github.com/users/mmashwani/following{/other_user}","gists_url":"https://api.github.com/users/mmashwani/gists{/gist_id}","starred_url":"https://api.github.com/users/mmashwani/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmashwani/subscriptions","organizations_url":"https://api.github.com/users/mmashwani/orgs","repos_url":"https://api.github.com/users/mmashwani/repos","events_url":"https://api.github.com/users/mmashwani/events{/privacy}","received_events_url":"https://api.github.com/users/mmashwani/received_events","type":"User","site_admin":false},"open_issues":6,"closed_issues":3,"state":"open","created_at":"2015-04-18T22:36:19Z","updated_at":"2015-05-19T20:25:58Z","due_on":"2015-05-19T04:00:00Z","closed_at":null},"comments":6,"created_at":"2015-05-11T19:21:37Z","updated_at":"2015-05-19T20:25:58Z","closed_at":"2015-05-19T20:25:58Z","body":"Environment\r\n------------------------\r\n* Windows 7 x64\r\n* SCCM 2012 R2\r\n* PSAppDeployToolkit 3.6.3\r\n\r\nCode Snippet:\r\n[scriptblock]$HKCURegistrySettings = {\r\n    Set-RegistryKey -Key 'HKCU\\Software\\Test' -Name 'qmenable' -Value 0 -Type DWord -SID $UserProfile.SID\r\n}\r\nInvoke-HKCURegistrySettingsForAllUsers -RegistrySettings $HKCURegistrySettings\r\n\r\nUser profiles which are loaded under HKEY_USERS do not unload if a new registry KEY is created.  When the KEY already exists, and only new VALUES are being written under the existing KEY, then the loaded user profiles appear to unload. Manual unloading of Default User succeeds via regedit.Below is an excerpt from the psappdeploykit log:\r\n[Installation] :: Failed to unload the registry hive for User [Default User] with SID [S-1-5-21-Default-User]. \r\nError Record:\r\n-------------\r\n\r\nMessage        : REG.exe failed with exit code [1] and result [].\r\nInnerException : \r\n\r\nFullyQualifiedErrorId : REG.exe failed with exit code [1] and result [].\r\nScriptStackTrace      : at Invoke-HKCURegistrySettingsForAllUsers<Process>, C:\\\r\n                        WINDOWS\\ccmcache\\8\\AppDeployToolkit\\AppDeployToolkitMai\r\n                        n.ps1: line 3446\r\n                        at <ScriptBlock>, C:\\WINDOWS\\ccmcache\\8\\test.ps1: line \r\n                        145\r\n                        at <ScriptBlock>, <No file>: line 1\r\n                        at <ScriptBlock>, <No file>: line 1\r\n\r\nPositionMessage : At C:\\WINDOWS\\ccmcache\\8\\AppDeployToolkit\\AppDeployToolkitMai\r\n                  n.ps1:3446 char:41\r\n                  +                         If ($global:LastExitCode -ne 0) { \r\n                  Throw \"REG.exe failed with exit code [$( ...\r\n                  +    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n\r\n\r\n\r\n"}}