Registry Picker to export registry files

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
Forum rules
DO NOT POST SUBSCRIPTION NUMBERS, LICENSE KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
User avatar
rubberduck
Posts: 54
Joined: Wed Oct 30, 2013 9:34 am

Registry Picker to export registry files

Post by rubberduck » Tue Mar 19, 2019 4:06 am

Product, version and build: Powershell Studio 2019, Version 5.6.160
32 or 64 bit version of product: 64bit
Operating system: Windows 10, 1803
32 or 64 bit OS: 64bit

I want to be able to click on a registration path in my Forms application and export it later.

I have tried to adapt your example, but unfortunately without success.
In the example I can only print the subkeys, but like in the picture when I click on 7zip I want to have the whole path to exactly this key. Later I want to export, import this key.
Is it possible that you give me another example, or customize your own?

Code: Select all

$formRegistrypicker_Load={
	$regKey = Get-Item HKLM:\
	$script:n = New-Object System.Windows.Forms.TreeNode
	$n.Name = $regKey.PsPath
	$n.Text = $regKey.Name
	$n.Tag = $regKey
	$treeview1.Nodes.Add($n)
	
}

$treeview1_NodeMouseClick = [System.Windows.Forms.TreeNodeMouseClickEventHandler]{
	if ($_.Node.Nodes.Count -eq 0) {
		foreach ($keyName in ($_.Node.Tag.GetSubkeyNames())) {
			Try {
				$regKey = $_.Node.Tag.OpenSubKey($keyName)
				$n = New-Object System.Windows.Forms.TreeNode
				$n.Name = $regKey.PsPath
				$n.Text = $keyName
				$n.Tag = $regKey
				$_.Node.Nodes.Add($n)
				
				
				
			} Catch {
				Write-Host $_
			}
		}
	}
	# display properties...



example_registrypicker.png
example_registrypicker.png (6.19 KiB) Viewed 1405 times

User avatar
davidc
Posts: 5913
Joined: Thu Aug 18, 2011 4:56 am

Re: Registry Picker to export registry files

Post by davidc » Tue Mar 19, 2019 8:06 am

I'm sorry, but I'm not familiar with this example. Can you provide a link?

It looks like you have access to the registry items directly, so you should be able to use the Name property of the RegistryKey object:

Code: Select all

$_.Node.Tag.Name
David
SAPIEN Technologies, Inc.

User avatar
rubberduck
Posts: 54
Joined: Wed Oct 30, 2013 9:34 am

Re: Registry Picker to export registry files

Post by rubberduck » Tue Mar 26, 2019 2:21 am

Hi and thanks for reply.
I thought this example was from you...I dont know the exact link anymore.

Code: Select all

[attachment=0]treeview.psf[/attachment]
Attachments
treeview.psf
(189.29 KiB) Downloaded 24 times

User avatar
rubberduck
Posts: 54
Joined: Wed Oct 30, 2013 9:34 am

Re: Registry Picker to export registry files

Post by rubberduck » Thu Apr 04, 2019 8:48 am

David, is it possible that you look at the example and answer the question?
I don't think I can do it alone.
Thank you for your help.
I just want to export a complete registry key using this 'Mini-GUI'.