{"id":369,"date":"2018-01-05T14:08:04","date_gmt":"2018-01-05T19:08:04","guid":{"rendered":"http:\/\/techref.camellarry.com\/?p=369"},"modified":"2018-01-05T14:12:22","modified_gmt":"2018-01-05T19:12:22","slug":"identify-all-user-keys-in-hkey_users","status":"publish","type":"post","link":"http:\/\/techref.camellarry.com\/?p=369","title":{"rendered":"Identify all user keys in HKEY_USERS"},"content":{"rendered":"<p>This example shows how to enumerate the user keys in HKEY_USERS<\/p>\n<pre>Public Sub OutputRegKey(Key As RegistryKey)\r\nImports Microsoft.Win32\r\n\r\nPublic Class Form1\r\n  Public arrUsers(100) As String, arrUsersMax As Integer = 0\r\n\r\n  Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load\r\n    Dim i As Integer\r\n    Dim txt As String = \"\"\r\n\r\n    '-------------------------------------------------------------------\r\n    ' identify the HKEY_Users\r\n    '-------------------------------------------------------------------\r\n    arrUsers(0) = \".DEFAULT\"\r\n\r\n    Dim regkey As RegistryKey = Registry.Users.OpenSubKey(\"\")\r\n    EnumerateHkeyUsers(regkey)\r\n    regkey.Close()\r\n\r\n    For i = 0 To arrUsersMax\r\n      txt += arrUsers(i) &amp; vbCrLf\r\n    Next\r\n\r\n    MsgBox(txt)\r\n    End\r\n  End Sub\r\n\r\n  Sub EnumerateHkeyUsers(ByVal rkey As RegistryKey)\r\n    Dim names As String() = rkey.GetSubKeyNames()\r\n    Dim txt As String = \"\"\r\n\r\n    For Each subkey In names\r\n      txt = subkey.ToString\r\n\r\n      If Len(txt) &gt; 10 And InStr(LCase(txt), \"_classes\") = 0 Then\r\n        arrUsersMax = arrUsersMax + 1\r\n        arrUsers(arrUsersMax) = txt\r\n      End If\r\n    Next\r\n  End Sub\r\n\r\nEnd Class\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>This example shows how to enumerate the user keys in HKEY_USERS Public Sub OutputRegKey(Key As RegistryKey) Imports Microsoft.Win32 Public Class Form1 Public arrUsers(100) As String, arrUsersMax As Integer = 0 Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load Dim i As Integer Dim txt As String = &#8220;&#8221; &#8216;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- &#8216; identify the HKEY_Users [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[9],"tags":[101,29,45,61,72,77,80],"class_list":["post-369","post","type-post","status-publish","format-standard","hentry","category-vb-net","tag-enumerate","tag-example","tag-microsoft","tag-registry","tag-syntax","tag-vb-net","tag-windows"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p9t3oE-5X","_links":{"self":[{"href":"http:\/\/techref.camellarry.com\/index.php?rest_route=\/wp\/v2\/posts\/369","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/techref.camellarry.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/techref.camellarry.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/techref.camellarry.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/techref.camellarry.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=369"}],"version-history":[{"count":5,"href":"http:\/\/techref.camellarry.com\/index.php?rest_route=\/wp\/v2\/posts\/369\/revisions"}],"predecessor-version":[{"id":374,"href":"http:\/\/techref.camellarry.com\/index.php?rest_route=\/wp\/v2\/posts\/369\/revisions\/374"}],"wp:attachment":[{"href":"http:\/\/techref.camellarry.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=369"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/techref.camellarry.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=369"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/techref.camellarry.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=369"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}