Forms Newbie

Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
User avatar
phurious
Posts: 15
Joined: Sun Mar 03, 2013 12:42 pm

Re: Forms Newbie

Post by phurious » Fri Jun 03, 2016 8:29 am

jvierra wrote:You must specify which hive you are querying.

The key is clearly a main hive key. If you run it as a 64 bit script on a 64 bit machine it will work correctly. The same on a 32 bit machine.
jvierra, I understand this but my question remains. Because this script is going to be packaged as a 32Bit executable, how do I successfully extract registry keys on any x64 system the tool may be run on?
Last edited by phurious on Fri Jun 03, 2016 8:36 am, edited 1 time in total.

User avatar
phurious
Posts: 15
Joined: Sun Mar 03, 2013 12:42 pm

Re: Forms Newbie

Post by phurious » Fri Jun 03, 2016 8:36 am

phurious wrote:
jvierra wrote:You must specify which hive you are querying.

The key is clearly a main hive key. If you run it as a 64 bit script on a 64 bit machine it will work correctly. The same on a 32 bit machine.
jvierra, I understand this but my question remains. Because this script is going to be packaged as a 32Bit executable, how do I successfully extract registry keys on any x64 system the tool may be run on?
Never mind. I found the /reg:64 switch which I previously was not aware existed. Thanks to jvierra and monoeagle's for their assistance!

User avatar
jvierra
Posts: 13395
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: Forms Newbie

Post by jvierra » Fri Jun 03, 2016 8:39 am

You will have to add code and ad the hive selector to the command line.

User avatar
jvierra
Posts: 13395
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: Forms Newbie

Post by jvierra » Fri Jun 03, 2016 8:43 am

Her is how to detect that:

if([environment]::Is64BitOperatingSystem){ <#add /reg:64 #> }

User avatar
phurious
Posts: 15
Joined: Sun Mar 03, 2013 12:42 pm

Re: Forms Newbie

Post by phurious » Fri Jun 03, 2016 9:04 am

jvierra wrote:Her is how to detect that:

if([environment]::Is64BitOperatingSystem){ <#add /reg:64 #> }
jvierra, I had added the below code:

Code: Select all

If([environment]::Is64BitOperatingSystem){$argument += "/reg:64"}
I am certain your code does the same thing or something very similar but I am unfamiliar with the last bit:

Code: Select all

<#add /reg:64 #>
This is appending the required switch, but how?
Last edited by phurious on Fri Jun 03, 2016 9:16 am, edited 1 time in total.

User avatar
jvierra
Posts: 13395
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: Forms Newbie

Post by jvierra » Fri Jun 03, 2016 9:08 am

It is an embedded comment.

User avatar
monoeagle
Posts: 107
Joined: Tue Oct 13, 2015 9:10 am

Re: Forms Newbie

Post by monoeagle » Fri Jun 03, 2016 4:23 pm

phurious wrote:Thanks to jvierra and monoeagle's for their assistance!
you're welcome

Locked