{"id":263,"date":"2023-08-30T09:35:39","date_gmt":"2023-08-30T15:35:39","guid":{"rendered":"https:\/\/tekweis.com\/?p=263"},"modified":"2024-04-22T18:18:45","modified_gmt":"2024-04-23T00:18:45","slug":"using-powershell-to-read-registry-hkey_users","status":"publish","type":"post","link":"https:\/\/tekweis.com\/index.php\/2023\/08\/30\/using-powershell-to-read-registry-hkey_users\/","title":{"rendered":"Using Powershell to read registry HKEY_USERS"},"content":{"rendered":"\n<p class=\"has-black-color has-text-color has-link-color wp-elements-12eebff1f8ba196aa088e4e921c1dd3b\">This is a small example I put together on how to quickly loop through each user SID in HKEY_USERS and find the value that shows what the wallpaper is set to for each user. This little script is a decent reference to use for finding (And with a little modification, setting) registry value(s) in the HKEY_USERS section. <\/p>\n\n\n\n<pre class=\"wp-block-code has-black-color has-pale-cyan-blue-background-color has-text-color has-background has-link-color has-small-font-size wp-elements-0738c15d669263cff424aa105ba76285\"><code>&lt;#\n.DESCRIPTION\n    Example to show how you can go through each user branch in registry \n    HKEY_USERS and retrieve the wallpaper file path key.\n#&gt;\n\n$hkUsers = &#91;Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('USERS', $env:COMPUTERNAME)\n$hkUsersSubkeys = $hkUsers.GetSubKeyNames()\n\n$hkUsersSubkeys | % {\n\n    $hkeyuserpath = \"$_\\Control Panel\\Desktop\"\n    $hkeyuserpath = \"REGISTRY::HKEY_USERS\\$hkeyuserpath\"\n\n    Write-Host \"`nUSER: $_\"\n    $wallpaperfile = (Get-ItemProperty -Path $hkeyuserpath -ErrorAction SilentlyContinue).Wallpaper\n    Write-Host \"WALLPAPER: $wallpaperfile`n`n====================\"\n\n}\n<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"976\" height=\"522\" src=\"https:\/\/tekweis.com\/wp-content\/uploads\/2023\/08\/UserWallpaperOutput.jpg\" alt=\"\" class=\"wp-image-266\" srcset=\"https:\/\/tekweis.com\/wp-content\/uploads\/2023\/08\/UserWallpaperOutput.jpg 976w, https:\/\/tekweis.com\/wp-content\/uploads\/2023\/08\/UserWallpaperOutput-300x160.jpg 300w, https:\/\/tekweis.com\/wp-content\/uploads\/2023\/08\/UserWallpaperOutput-768x411.jpg 768w, https:\/\/tekweis.com\/wp-content\/uploads\/2023\/08\/UserWallpaperOutput-660x353.jpg 660w\" sizes=\"auto, (max-width: 976px) 100vw, 976px\" \/><figcaption class=\"wp-element-caption\">Script execution. Shows the wallpaper path and file used for each user account in HKEY_USERS of the Windows registry.<\/figcaption><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>This is a small example I put together on how to quickly loop through each user SID in HKEY_USERS and find the value that shows what the wallpaper is set to for each user. This little script is a decent reference to use for finding (And with a little modification, setting) registry value(s) in the\u2026 <span class=\"read-more\"><a href=\"https:\/\/tekweis.com\/index.php\/2023\/08\/30\/using-powershell-to-read-registry-hkey_users\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-263","post","type-post","status-publish","format-standard","hentry","category-windows"],"_links":{"self":[{"href":"https:\/\/tekweis.com\/index.php\/wp-json\/wp\/v2\/posts\/263","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tekweis.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tekweis.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tekweis.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tekweis.com\/index.php\/wp-json\/wp\/v2\/comments?post=263"}],"version-history":[{"count":8,"href":"https:\/\/tekweis.com\/index.php\/wp-json\/wp\/v2\/posts\/263\/revisions"}],"predecessor-version":[{"id":350,"href":"https:\/\/tekweis.com\/index.php\/wp-json\/wp\/v2\/posts\/263\/revisions\/350"}],"wp:attachment":[{"href":"https:\/\/tekweis.com\/index.php\/wp-json\/wp\/v2\/media?parent=263"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tekweis.com\/index.php\/wp-json\/wp\/v2\/categories?post=263"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tekweis.com\/index.php\/wp-json\/wp\/v2\/tags?post=263"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}