{"id":984,"date":"2010-10-18T13:51:45","date_gmt":"2010-10-18T17:51:45","guid":{"rendered":"http:\/\/jdhitsolutions.com\/blog\/?p=984"},"modified":"2010-10-18T13:51:45","modified_gmt":"2010-10-18T17:51:45","slug":"export-registry","status":"publish","type":"post","link":"https:\/\/jdhitsolutions.com\/blog\/scripting\/984\/export-registry\/","title":{"rendered":"Export Registry"},"content":{"rendered":"<p>Over the last week or so I've posted some functions for testing whether a given registry item exists or not, or even validating its value. To round this out, today I have an advanced function that makes it easier to export parts of the registry on the local computer.<!--more--><\/p>\n<p>The name of the function is Export-Registry, although I apologize if the name is a little misleading. Its purpose is to export a registry key and values to either a CSV or XML file. Here's the function.<br \/>\n[cc lang=\"PowerShell\"]<br \/>\nFunction Export-Registry<\/p>\n<p>[cmdletBinding()]<\/p>\n<p>Param(<br \/>\n[Parameter(Position=0,Mandatory=$True,<br \/>\nHelpMessage=\"Enter a registry path using the PSDrive format.\",<br \/>\nValueFromPipeline=$True,ValueFromPipelineByPropertyName=$True)]<br \/>\n[ValidateScript({(Test-Path $_) -AND ((Get-Item $_).PSProvider.Name -match \"Registry\")})]<br \/>\n[Alias(\"PSPath\")]<br \/>\n[string[]]$Path,<\/p>\n<p>[Parameter()]<br \/>\n[ValidateSet(\"csv\",\"xml\")]<br \/>\n[string]$ExportType,<\/p>\n<p>[Parameter()]<br \/>\n[string]$ExportPath,<\/p>\n<p>[switch]$NoBinary<\/p>\n<p>)<\/p>\n<p>Begin {<br \/>\n    Write-Verbose -Message \"$(Get-Date) Starting $($myinvocation.mycommand)\"<br \/>\n    #initialize an array to hold the results<br \/>\n    $data=@()<br \/>\n } #close Begin<\/p>\n<p>Process {<br \/>\n    #go through each pipelined path<br \/>\n    Foreach ($item in $path) {<br \/>\n        Write-Verbose \"Exporting non binary properties from $item\"<br \/>\n        #get property names<br \/>\n        $properties= Get-ItemProperty -path $item |<br \/>\n        #exclude the PS properties<br \/>\n         Select * -Exclude PS*Path,PSChildName,PSDrive,PSProvider |<br \/>\n         Get-Member -MemberType NoteProperty,Property -erroraction \"SilentlyContinue\"<br \/>\n        if ($NoBinary)<br \/>\n        {<br \/>\n            #filter out binary items<br \/>\n            Write-Verbose \"Filtering out binary properties\"<br \/>\n            $properties=$properties | Where {$_.definition -notmatch \"byte\"}<br \/>\n        }<br \/>\n        Write-Verbose \"Retrieved $(($properties | measure-object).count) properties\"<br \/>\n        #enumrate each property getting itsname,value and type<br \/>\n        foreach ($property in $properties) {<br \/>\n            Write-Verbose \"Exporting $property\"<br \/>\n            $value=(get-itemproperty -path $item -name $property.name).$($property.name)<\/p>\n<p>            if (-not ($properties))<br \/>\n            {<br \/>\n                #no item properties were found so create a default entry<br \/>\n                $value=$Null<br \/>\n                $PropertyItem=\"(Default)\"<br \/>\n                $RegType=\"System.String\"<br \/>\n            }<br \/>\n            else<br \/>\n            {<br \/>\n                #get the registry value type<br \/>\n                $regType=$property.Definition.Split()[0]<br \/>\n                $PropertyItem=$property.name<br \/>\n            }<br \/>\n            #create a custom object for each entry and add it the temporary array<br \/>\n            $data+=New-Object -TypeName PSObject -Property @{<br \/>\n                \"Path\"=$item<br \/>\n                \"Name\"=$propertyItem<br \/>\n                \"Value\"=$value<br \/>\n                \"Type\"=$regType<br \/>\n                \"Computername\"=$env:computername<br \/>\n            }<br \/>\n        } #foreach $property<br \/>\n    }#close Foreach<br \/>\n } #close process<\/p>\n<p>End {<br \/>\n  #make sure we got something back<br \/>\n  if ($data)<br \/>\n  {<br \/>\n    #export to a file both a type and path were specified<br \/>\n    if ($ExportType -AND $ExportPath)<br \/>\n    {<br \/>\n      Write-Verbose \"Exporting $ExportType data to $ExportPath\"<br \/>\n      Switch ($exportType) {<br \/>\n        \"csv\" { $data | Export-CSV -Path $ExportPath -noTypeInformation }<br \/>\n        \"xml\" { $data | Export-CLIXML -Path $ExportPath }<br \/>\n      } #switch<br \/>\n    } #if $exportType<br \/>\n    elseif ( ($ExportType -AND (-not $ExportPath)) -OR ($ExportPath -AND (-not $ExportType)) )<br \/>\n    {<br \/>\n        Write-Warning \"You forgot to specify both an export type and file.\"<br \/>\n    }<br \/>\n    else<br \/>\n    {<br \/>\n        #write data to the pipeline<br \/>\n        $data<br \/>\n    }<br \/>\n   } #if $#data<br \/>\n   else<br \/>\n   {<br \/>\n        Write-Verbose \"No data found\"<br \/>\n        Write \"No data found\"<br \/>\n   }<br \/>\n     #exit the function<br \/>\n     Write-Verbose -Message \"$(Get-Date) Ending $($myinvocation.mycommand)\"<br \/>\n } #close End<\/p>\n<p>} #end Function<br \/>\n[\/cc]<br \/>\nI've omitted the comment based help, but it is there.<br \/>\n<a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/10\/export-registry-help.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/10\/export-registry-help-1024x526.png\" alt=\"\" title=\"export-registry-help\" width=\"640\" height=\"328\" class=\"aligncenter size-large wp-image-985\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/10\/export-registry-help-1024x526.png 1024w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/10\/export-registry-help-300x154.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/10\/export-registry-help.png 1372w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/p>\n<p>The function requires a registry path, using the PSDriver format, like hklm:\\system\\currentcontrolset\\services\\browser\\parameters. Assuming the path exists, the function uses Get-ItemProperty to retrieve a list property values for the registry key<br \/>\n[cc lang=\"PowerShell\"]<br \/>\n  $properties= Get-ItemProperty -path $item |<br \/>\n        #exclude the PS properties<br \/>\n         Select * -Exclude PS*Path,PSChildName,PSDrive,PSProvider |<br \/>\n Get-Member -MemberType NoteProperty,Property -erroraction \"SilentlyContinue\"<br \/>\n[\/cc]<br \/>\nHowever, the function excludes the properties like PSDrive and PSProvider since they aren't technically part of the registry entry these values are then piped to Get-Member. The end result is that $properties is a collection of registry property names. This collection is used in a ForEach construct to get the value for each time.<br \/>\n[cc lang=\"PowerShell\"]<br \/>\n foreach ($property in $properties) {<br \/>\n            Write-Verbose \"Exporting $property\"<br \/>\n            $value=(get-itemproperty -path $item -name $property.name).$($property.name)<br \/>\n[\/cc]<br \/>\nAssuming a value was found, I define some variables to hold the property type, such as System.String<br \/>\n[cc lang=\"PowerShell\"]<br \/>\n #get the registry value type<br \/>\n                $regType=$property.Definition.Split()[0]<br \/>\n                $PropertyItem=$property.name<br \/>\n[\/cc]<br \/>\nFor each registry property, the function creates a custom object which is then added to a temporary array.<br \/>\n[cc lang=\"PowerShell\"]<br \/>\n#create a custom object for each entry and add it the temporary array<br \/>\n            $data+=New-Object -TypeName PSObject -Property @{<br \/>\n                \"Path\"=$item<br \/>\n                \"Name\"=$propertyItem<br \/>\n                \"Value\"=$value<br \/>\n                \"Type\"=$regType<br \/>\n                \"Computername\"=$env:computername<br \/>\n[\/cc]<br \/>\nAll of this happens in a Process Script block. In the End scriptblock $data is written to the pipeline. The end result is something like this:<br \/>\n[cc lang=\"DOS\"]<br \/>\nPS C:\\> export-registry hklm:\\system\\currentcontrolset\\services\\browser\\parameters<\/p>\n<p>Value        : False<br \/>\nName         : IsDomainMaster<br \/>\nPath         : hklm:\\system\\currentcontrolset\\services\\browser\\parameters<br \/>\nType         : System.String<br \/>\nComputername : SERENITY<\/p>\n<p>Value        : False<br \/>\nName         : MaintainServerList<br \/>\nPath         : hklm:\\system\\currentcontrolset\\services\\browser\\parameters<br \/>\nType         : System.String<br \/>\nComputername : SERENITY<\/p>\n<p>Value        : C:\\Windows\\System32\\browser.dll<br \/>\nName         : ServiceDll<br \/>\nPath         : hklm:\\system\\currentcontrolset\\services\\browser\\parameters<br \/>\nType         : System.String<br \/>\nComputername : SERENITY<\/p>\n<p>Value        : 1<br \/>\nName         : ServiceDllUnloadOnStop<br \/>\nPath         : hklm:\\system\\currentcontrolset\\services\\browser\\parameters<br \/>\nType         : System.Int32<br \/>\nComputername : SERENITY<br \/>\n[\/cc]<br \/>\nBy the way, if the registry key has no values, then I create a (Default) entry, just like you'd see in Regedit.exe.<br \/>\n[cc lang=\"PowerShell\"]<br \/>\n#no item properties were found so create a default entry<br \/>\n                $value=$Null<br \/>\n                $PropertyItem=\"(Default)\"<br \/>\n                $RegType=\"System.String\"<br \/>\n[\/cc]<br \/>\nBut where's the export to a file? I like my functions to be as flexible and re-usable as possible so by default the function writes the custom objects to the pipeline, where presumably you could perform additional sorting, grouping or filtering. Oh....because  exporting binary data generally doesn't serve much purpose, the function has a -NoBinary switch which will filter out the properties that are of the type System.Byte[].<br \/>\n[cc lang=\"PowerShell\"]<br \/>\nif ($NoBinary)<br \/>\n        {<br \/>\n            #filter out binary items<br \/>\n            Write-Verbose \"Filtering out binary properties\"<br \/>\n            $properties=$properties | Where {$_.definition -notmatch \"byte\"}<br \/>\n        }<br \/>\n[\/cc]<br \/>\nI could have stopped at this and simply let you pipe Export-Registry to Export-CSV or Export-Clixml. But to stick somewhat to the function name, you can specify whether to export to a CSV or XML format. The latter is better for more complex entries. In either case, you also need to specify a filename and path.<br \/>\n[cc lang=\"PowerShell\"]<br \/>\nif ($ExportType -AND $ExportPath)<br \/>\n    {<br \/>\n      Write-Verbose \"Exporting $ExportType data to $ExportPath\"<br \/>\n      Switch ($exportType) {<br \/>\n        \"csv\" { $data | Export-CSV -Path $ExportPath -noTypeInformation }<br \/>\n        \"xml\" { $data | Export-CLIXML -Path $ExportPath }<br \/>\n      } #switch<br \/>\n    } #if $exportType<br \/>\n[\/cc]<\/p>\n<p>Because the function accepts pipelined input, you can export more than one registry key.<br \/>\n[cc lang=\"PowerShell\"]<br \/>\nPS C:\\> dir hklm:\\software\\microsoft\\windows\\currentversion\\uninstall |<br \/>\n>>  export-registry -ExportType Csv -ExportPath \"C:\\work\\uninstall.csv\" -NoBinary<br \/>\nPS C:\\> dir hklm:\\system\\currentcontrolset\\services\\tcpip -recurse |<br \/>\n>> export-registry -nobinary -ExportType XML -ExportPath c:\\work\\tcpip.xml<br \/>\n[\/cc]<br \/>\nThe first example will create a CSV export file for all registry entries under UnInstall, excluding any binary data. The second recursively gets all TCPIP registry items and exports to a PowerShell xml file.  <\/p>\n<p>Finally, because the function includes the computer name, when you run the function remotely, the computer name helps identify what values belong to which computer. To use the function with something like Invoke-Command you could write a script that used the function and exported the information. Another way would be to create a number of PSSessions and use them.<\/p>\n<p>After creating your sessions, the first step is to source the file with the function on the remote computers.<br \/>\n[cc lang=\"PowerShell\"]<br \/>\nPS C:\\> Invoke-Command -Session $s1,$s2 -FilePath \"c:\\scripts\\export-registry.ps1\"<br \/>\n[\/cc]<br \/>\nNow I can run any export-registry command I'd like.<br \/>\n[cc lang=\"PowerShell\"]<br \/>\nPS C:\\> Invoke-Command -Session $s1,$s2 {Export-Registry \"HKLM:\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\" -nobinary}<br \/>\n[\/cc]<br \/>\nIf I used the export to file parameters, I'll get file on each computer. Here's where the flexibility comes in. Because I'd like a single file for both sessions, I'll take the Invoke-Command results and pipe them to an appopriate cmdlet on my computer.<br \/>\n[cc lang=\"PowerShell\"]<br \/>\nPS C:\\> Invoke-Command -Session $s1,$s2 {Export-Registry \"HKLM:\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\" -nobinary }-hidecomputername | Select * -ExcludeProperty RunspaceID | export-csv c:\\work\\WinLogon.csv<br \/>\n[\/cc]<br \/>\nBecause my exported object already has the computername, I don't need it or the runspaceID from Invoke-Command. Now I have some useful data I can re-import and analyze all I want.<\/p>\n<p>Download <a href='http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/10\/Export-Registry.txt'>Export-Registry<\/a> and let me know what you think.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Over the last week or so I&#8217;ve posted some functions for testing whether a given registry item exists or not, or even validating its value. To round this out, today I have an advanced function that makes it easier to export parts of the registry on the local computer.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[75,110,8],"tags":[204,224,534,560,540],"class_list":["post-984","post","type-post","status-publish","format-standard","hentry","category-powershell-v2-0","category-registry","category-scripting","tag-export","tag-function","tag-powershell","tag-registry","tag-scripting"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Export Registry &#8226; The Lonely Administrator<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/jdhitsolutions.com\/blog\/scripting\/984\/export-registry\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Export Registry &#8226; The Lonely Administrator\" \/>\n<meta property=\"og:description\" content=\"Over the last week or so I&#039;ve posted some functions for testing whether a given registry item exists or not, or even validating its value. To round this out, today I have an advanced function that makes it easier to export parts of the registry on the local computer.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jdhitsolutions.com\/blog\/scripting\/984\/export-registry\/\" \/>\n<meta property=\"og:site_name\" content=\"The Lonely Administrator\" \/>\n<meta property=\"article:published_time\" content=\"2010-10-18T17:51:45+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/10\/export-registry-help-1024x526.png\" \/>\n<meta name=\"author\" content=\"Jeffery Hicks\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@JeffHicks\" \/>\n<meta name=\"twitter:site\" content=\"@JeffHicks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jeffery Hicks\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/984\\\/export-registry\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/984\\\/export-registry\\\/\"},\"author\":{\"name\":\"Jeffery Hicks\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"headline\":\"Export Registry\",\"datePublished\":\"2010-10-18T17:51:45+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/984\\\/export-registry\\\/\"},\"wordCount\":1297,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/984\\\/export-registry\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2010\\\/10\\\/export-registry-help-1024x526.png\",\"keywords\":[\"export\",\"Function\",\"PowerShell\",\"Registry\",\"Scripting\"],\"articleSection\":[\"PowerShell v2.0\",\"Registry\",\"Scripting\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/984\\\/export-registry\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/984\\\/export-registry\\\/\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/984\\\/export-registry\\\/\",\"name\":\"Export Registry &#8226; The Lonely Administrator\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/984\\\/export-registry\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/984\\\/export-registry\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2010\\\/10\\\/export-registry-help-1024x526.png\",\"datePublished\":\"2010-10-18T17:51:45+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/984\\\/export-registry\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/984\\\/export-registry\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/984\\\/export-registry\\\/#primaryimage\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2010\\\/10\\\/export-registry-help.png\",\"contentUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2010\\\/10\\\/export-registry-help.png\",\"width\":\"1372\",\"height\":\"705\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/984\\\/export-registry\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"PowerShell v2.0\",\"item\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/category\\\/powershell-v2-0\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Export Registry\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/\",\"name\":\"The Lonely Administrator\",\"description\":\"Practical Advice for the Automating IT Pro\",\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\",\"name\":\"Jeffery Hicks\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"caption\":\"Jeffery Hicks\"},\"logo\":{\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Export Registry &#8226; The Lonely Administrator","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/jdhitsolutions.com\/blog\/scripting\/984\/export-registry\/","og_locale":"en_US","og_type":"article","og_title":"Export Registry &#8226; The Lonely Administrator","og_description":"Over the last week or so I've posted some functions for testing whether a given registry item exists or not, or even validating its value. To round this out, today I have an advanced function that makes it easier to export parts of the registry on the local computer.","og_url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/984\/export-registry\/","og_site_name":"The Lonely Administrator","article_published_time":"2010-10-18T17:51:45+00:00","og_image":[{"url":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/10\/export-registry-help-1024x526.png","type":"","width":"","height":""}],"author":"Jeffery Hicks","twitter_card":"summary_large_image","twitter_creator":"@JeffHicks","twitter_site":"@JeffHicks","twitter_misc":{"Written by":"Jeffery Hicks","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/984\/export-registry\/#article","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/984\/export-registry\/"},"author":{"name":"Jeffery Hicks","@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"headline":"Export Registry","datePublished":"2010-10-18T17:51:45+00:00","mainEntityOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/984\/export-registry\/"},"wordCount":1297,"commentCount":1,"publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/984\/export-registry\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/10\/export-registry-help-1024x526.png","keywords":["export","Function","PowerShell","Registry","Scripting"],"articleSection":["PowerShell v2.0","Registry","Scripting"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/jdhitsolutions.com\/blog\/scripting\/984\/export-registry\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/984\/export-registry\/","url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/984\/export-registry\/","name":"Export Registry &#8226; The Lonely Administrator","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/984\/export-registry\/#primaryimage"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/984\/export-registry\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/10\/export-registry-help-1024x526.png","datePublished":"2010-10-18T17:51:45+00:00","breadcrumb":{"@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/984\/export-registry\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jdhitsolutions.com\/blog\/scripting\/984\/export-registry\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/984\/export-registry\/#primaryimage","url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/10\/export-registry-help.png","contentUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/10\/export-registry-help.png","width":"1372","height":"705"},{"@type":"BreadcrumbList","@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/984\/export-registry\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"PowerShell v2.0","item":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell-v2-0\/"},{"@type":"ListItem","position":2,"name":"Export Registry"}]},{"@type":"WebSite","@id":"https:\/\/jdhitsolutions.com\/blog\/#website","url":"https:\/\/jdhitsolutions.com\/blog\/","name":"The Lonely Administrator","description":"Practical Advice for the Automating IT Pro","publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/jdhitsolutions.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9","name":"Jeffery Hicks","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","url":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","caption":"Jeffery Hicks"},"logo":{"@id":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg"}}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":1078,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1078\/importing-and-exporting-registry-items\/","url_meta":{"origin":984,"position":0},"title":"Importing and Exporting Registry Items","author":"Jeffery Hicks","date":"January 25, 2011","format":false,"excerpt":"A while ago I posted a function to export registry items to either a CSV or XML file. Recently I had a question on Twitter about importing, which I assumed meant from my exported file. The import is actually pretty easy as I'll show you, although it did require a\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1811,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1811\/export-registry-printer-information-i-came\/","url_meta":{"origin":984,"position":1},"title":"Export Registry Printer Information I came&#8230;","author":"Jeffery Hicks","date":"November 2, 2011","format":false,"excerpt":"Export Registry Printer InformationI came across this post http:\/\/www.oncallpros.com\/2011\/11\/02\/powershell-export-your-print-configuration-from-registry\/ on exporting printer information from the registry in PowerShell. I wanted to offer some constructive suggestions but could find no way to comment so I'll do so here.First, the article introduces some good PowerShell concepts. I like that he is using\u2026","rel":"","context":"In &quot;Google Plus&quot;","block_context":{"text":"Google Plus","link":"https:\/\/jdhitsolutions.com\/blog\/category\/google-plus\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":953,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/953\/test-registry-item\/","url_meta":{"origin":984,"position":2},"title":"Test Registry Item","author":"Jeffery Hicks","date":"October 4, 2010","format":false,"excerpt":"I've been doing some work lately involving the registry and Windows PowerShell. One of the tasks was to create new registry keys and entries. But because I wanted to some robustness, I wanted a way to verify if a given key or entry already existed. Using Get-ItemProperty is the easy\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1413,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1413\/get-registry-size-and-age\/","url_meta":{"origin":984,"position":3},"title":"Get Registry Size and Age","author":"Jeffery Hicks","date":"May 4, 2011","format":false,"excerpt":"I'm not sure why the registry has been on my mind lately. I probably need a vacation to get out more. But I put together a relatively simple Windows PowerShell function to retrieve registry statistics that you might find useful. My Get-Registry function will return information about the size of\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/05\/registry.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":969,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/969\/test-registry-item-revisited\/","url_meta":{"origin":984,"position":4},"title":"Test Registry Item Revisited","author":"Jeffery Hicks","date":"October 15, 2010","format":false,"excerpt":"I got some nice feedback on my original Test-RegistryItem function. I had been mulling some enhancements anyway and now have a more robust version that looks at individual values, accepts pipelined input and more The new version now lets you test if a given registry item exists as well as\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":455,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/455\/get-printer\/","url_meta":{"origin":984,"position":5},"title":"Get-Printer","author":"Jeffery Hicks","date":"October 16, 2009","format":false,"excerpt":"I think Out-Printer is a very handy cmdlet, and one that doesn\u2019t get used much. Pipe any cmdlet to it and the output will be printed to your default printer. You use it the same way you would Out-File except output is printed instead of saved to a file. The\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/984","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=984"}],"version-history":[{"count":0,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/984\/revisions"}],"wp:attachment":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=984"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=984"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=984"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}