Page 1 of 1

Registry Picker to export registry files

Posted: Tue Mar 19, 2019 4:06 am
by rubberduck
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 1475 times

Re: Registry Picker to export registry files

Posted: Tue Mar 19, 2019 8:06 am
by davidc
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

Re: Registry Picker to export registry files

Posted: Tue Mar 26, 2019 2:21 am
by rubberduck
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]

Re: Registry Picker to export registry files

Posted: Thu Apr 04, 2019 8:48 am
by rubberduck
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'.