Topic: How to import a local Registry Key (C: drive) into Win PESE ?  (Read 1490 times)

0 Members and 2 Guests are viewing this topic.

How to import a local Registry Key (C: drive) into Win PESE ?
« on: January 29, 2018, 11:15:33 AM »

topgundcp

  • Jr. Chef
  • **
  • Location: San Jose, California
  • Date Registered: Oct 2015
  • Posts: 67
The key in question is:
HKLM\SYSTEM\MountedDevices

By importing this Key into WinPE, All drive letters assigned in Local machine will be assigned correctly in WinPE.

So how do I do it in the script to import the whole content of this key ? and can it be done before boot into WinPE ?

Thanks

Re: How to import a local Registry Key (C: drive) into Win PESE ?
« Reply #1 on: January 29, 2018, 11:24:12 AM »

bob.omb

  • Chef
  • ***
  • Location: USA
  • Date Registered: Jul 2017
  • Posts: 317
You can either mount the WIM with DISM and remote edit the registry inside the WIM, -or- you can use RegCPE in the Utils section of the project to convert the keys for use in a plugin.

To remote edit: (Example is with the SOFTWARE hive)

1.) Export your keys to a .reg file and Use DISM to mount your WIM
2.) Open Regedit.exe
3.) Click and highlight HKEY_LOCAL_MACHINE
4.) Select File>Load Hive from the menubar
5.) Navigate to the hive you wish to edit in the WIM - MOUNTFOLDER\Windows\System32\config\SOFTWARE ---> use the name ---> tmp_SOFTWARE)
6.) Edit the .reg file you exported with the keys you want to add so that the key path is changed from SOFTWARE to tmp_SOFTWARE
7.) Double click the reg file to add it.
8.) Click and highlight main tmp_SOFTWARE key under HKEY_LOCAL_MACHINE
9.) Select File>Unload Hive
10.) Unmount WIM and commit changes

-or-

Second method RegCPE:

1.) Export keys to a .reg file
2.) Open your PESE project
3.) At the bottom of your project list open Utils>RegCPE
4.) Leave all the default settings
5.) Select the folder icon to load a .reg file
6.) click Goooo Reg file
7.) Copy the code and paste it into your plugin.

 :great:
« Last Edit: January 29, 2018, 11:43:37 AM by bob.omb »

Re: How to import a local Registry Key (C: drive) into Win PESE ?
« Reply #2 on: January 29, 2018, 11:48:49 AM »

topgundcp

  • Jr. Chef
  • **
  • Location: San Jose, California
  • Date Registered: Oct 2015
  • Posts: 67
You can either mount the WIM with DISM and remote edit the registry inside the WIM, -or- you can use RegCPE in the Utils section of the project to convert the keys for use in a plugin.

To remote edit: (Example is with the SOFTWARE hive)

1.) Export your keys to a .reg file and Use DISM to mount your WIM
2.) Open Regedit.exe
3.) Click and highlight HKEY_LOCAL_MACHINE
4.) Select File>Load Hive from the menubar
5.) Navigate to the hive you wish to edit in the WIM - MOUNTFOLDER\Windows\System32\config\SOFTWARE ---> use the name ---> tmp_SOFTWARE)
6.) Edit the .reg file you exported with the keys you want to add so that the key path is changed from SOFTWARE to tmp_SOFTWARE
7.) Double click the reg file to add it.
8.) Click and highlight main tmp_SOFTWARE key under HKEY_LOCAL_MACHINE
9.) Select File>Unload Hive
10.) Unmount WIM and commit changes

-or-

Second method RegCPE:

1.) Export keys to a .reg file
2.) Open your PESE project
3.) At the bottom of your project list open Utils>RegCPE
4.) Leave all the default settings
5.) Select the folder icon to load a .reg file
6.) click Goooo Reg file
7.) Copy the code and paste it into your plugin.

 :great:
THat's exactly what I did. Export the Key, Use RegCPE, edit and add into the script. This works only on the PC that I am building the Win PE.
But that's not what I want. I want to dynamically export/import at boot time so it would work on any PC.

Re: How to import a local Registry Key (C: drive) into Win PESE ?
« Reply #3 on: January 29, 2018, 01:38:05 PM »

bob.omb

  • Chef
  • ***
  • Location: USA
  • Date Registered: Jul 2017
  • Posts: 317
If you put registry keys in a plugin then they are permanently inside the WIM and will load during each boot on any machine you boot the image on...  if you added them correctly, your problem is not with the keys being loaded properly, those keys are probably specific to what hardware is plugged in therefore will only work for that one machine.

Open regedit and search for the keys you added, they will be there......

What you are trying to do is not going to work, you cannot copy mounted devices and move to different hardware with it..
« Last Edit: January 29, 2018, 01:41:58 PM by bob.omb »

Re: How to import a local Registry Key (C: drive) into Win PESE ?
« Reply #4 on: January 29, 2018, 04:50:25 PM »

topgundcp

  • Jr. Chef
  • **
  • Location: San Jose, California
  • Date Registered: Oct 2015
  • Posts: 67
If you put registry keys in a plugin then they are permanently inside the WIM and will load during each boot on any machine you boot the image on...  if you added them correctly, your problem is not with the keys being loaded properly, those keys are probably specific to what hardware is plugged in therefore will only work for that one machine.

Open regedit and search for the keys you added, they will be there......

What you are trying to do is not going to work, you cannot copy mounted devices and move to different hardware with it..
That's the whole reason why I created this thread and may be I misunderstood your previous post. In step 1, you said: Export the Key to a reg file,
what key are you referring to ? is it: KHLM\SYSTEM\MountedDevices  from local PC ? If so then that's what I did.
Quote
What you are trying to do is not going to work, you cannot copy mounted devices and move to different hardware with it..
FYI, I did try to boot WinPE in another PC and all the HD/SSD drive mapped correctly except the Removable and DVD were not.

Here's the script, if you want to try it:
« Last Edit: January 29, 2018, 04:57:31 PM by topgundcp »

Re: How to import a local Registry Key (C: drive) into Win PESE ?
« Reply #5 on: January 29, 2018, 05:15:21 PM »

bob.omb

  • Chef
  • ***
  • Location: USA
  • Date Registered: Jul 2017
  • Posts: 317
It should be fair to go on the assumption that you already know how to use a registry editor. 

https://www.youtube.com/watch?v=DkLwsXPq6fM  <=== How to export a registry key into a .reg file

As I said before what you are trying to do will not work well at all.  Try using the Letterswap Plugin or CD X: Y: plugin. 
« Last Edit: January 29, 2018, 05:17:11 PM by bob.omb »

Re: How to import a local Registry Key (C: drive) into Win PESE ?
« Reply #6 on: January 29, 2018, 05:25:08 PM »

topgundcp

  • Jr. Chef
  • **
  • Location: San Jose, California
  • Date Registered: Oct 2015
  • Posts: 67
It should be fair to go on the assumption that you already know how to use a registry editor. 

https://www.youtube.com/watch?v=DkLwsXPq6fM  <=== How to export a registry key into a .reg file

As I said before what you are trying to do will not work well at all.  Try using the Letterswap Plugin or CD X: Y: plugin.
Again you misunderstood my question. It's not how to export the registry. What key are you referring to in your step  1 ????

Re: How to import a local Registry Key (C: drive) into Win PESE ?
« Reply #7 on: January 29, 2018, 08:07:41 PM »

bob.omb

  • Chef
  • ***
  • Location: USA
  • Date Registered: Jul 2017
  • Posts: 317
*Sigh* again...you wanna know how to put this key in

The key in question is:
HKLM\SYSTEM\MountedDevices <==THIS IS THE KEY FROM STEP ONE - THE ONE -->YOU<-- HAVE BEEN ASKING ABOUT THIS WHOLE TIME

https://www.youtube.com/watch?v=DkLwsXPq6fM  <=== How to export a registry key into a .reg file

EXPORT THE KEY YOU ARE ASKING ABOUT INTO A .REG FILE

THEN ===>

USE RegCPE TO CONVERT THE KEY AND PUT THE CODE INSIDE WHATEVER PLUGIN YOU ARE MAKING

Second method RegCPE:

1.) Export keys to a .reg file
2.) Open your PESE project
3.) At the bottom of your project list open Utils>RegCPE
4.) Leave all the default settings
5.) Select the folder icon to load a .reg file
6.) click Goooo Reg file
7.) Copy the code and paste it into your plugin.

THEN ====>

Open regedit and search for the keys you added, they will be there......

What you are trying to do is not going to work, you cannot copy mounted devices and move to different hardware with it..

Again... I am answering your question exactly on how to take the key your described and bake it into your build.  They key injected this way is loaded during boot,

EITHER Copying the key is NOT going to have the desired effect OR you are not asking the question correctly, but this is a direct answer to your question.  If you need further help please ask a different question..

If you are doing the above step you are putting the keys in and they are loading at boot.  The question you should probably be asking is "Why is it not working"
« Last Edit: January 29, 2018, 08:23:18 PM by bob.omb »

Re: How to import a local Registry Key (C: drive) into Win PESE ?
« Reply #8 on: January 29, 2018, 08:18:40 PM »

topgundcp

  • Jr. Chef
  • **
  • Location: San Jose, California
  • Date Registered: Oct 2015
  • Posts: 67
I've already told you that's exactly what I did in post #2, you did not tell me anything different. I even attached the script for you to see and you didn't even bother to look.
Anyway, thanks.

Re: How to import a local Registry Key (C: drive) into Win PESE ?
« Reply #9 on: January 29, 2018, 08:23:56 PM »

bob.omb

  • Chef
  • ***
  • Location: USA
  • Date Registered: Jul 2017
  • Posts: 317
No YOUR not telling ME anything different. You asked how to do that, now you did that. So....

We are at a point where you expect me to miraculously come up with more information that is going to somehow benefit you and make your idea(which I have no idea what your idea is) a reality..

When really I have no idea what you want from me, you asked how to import the keys, I TOLD YOU HOW, you said "I ALREADY DID THAT"

GREAT!!!!

SO NOW WHAT? You ALREADY did what you need to do TO IMPORT THE KEYS.  WHAT IS THE PROBLEM? DO YOU HAVE MORE QUESTIONS? ARE THE KEYS IMPORTED AND ITS NOT WORKING?

===> ASK MORE QUESTIONS IF YOU WANT MORE ANSWERS <===

 :thumbsup:
« Last Edit: January 29, 2018, 08:57:17 PM by bob.omb »

Re: How to import a local Registry Key (C: drive) into Win PESE ?
« Reply #10 on: January 29, 2018, 10:37:44 PM »

topgundcp

  • Jr. Chef
  • **
  • Location: San Jose, California
  • Date Registered: Oct 2015
  • Posts: 67
My apology that I was not clear on my question. I have no problem export the registry key and build the script to import into WinPE. My question was, Before boot into WinPE, is there a way to export the key from C drive and import into WinPE . For example, set up a Autorun, use "reg export" to read the key then use "reg import" to import into WinPE so that the mounted devices will match with the PC you boot from.
« Last Edit: January 29, 2018, 10:43:48 PM by topgundcp »

Re: How to import a local Registry Key (C: drive) into Win PESE ?
« Reply #11 on: January 30, 2018, 03:09:28 AM »

Lancelot

  • Gena Baker
  • Grand Chef
  • *****
  • Date Registered: Sep 2010
  • Posts: 7781
2 plugins available topgundcp

*
Apps\System Tools\LetterSwap
->
I guess LetterSwap do what you wrote:
Quote
use "reg export" to read the key then use "reg import" to import into WinPE so that the mounted devices will match with the PC you boot from.

*
Downloads\TweaksY\MountedDevices Host
Do what you wrote on the initial topic post, it is for the home user with a single computer.



****
topgundcp

You are around for a long time now.

Use "plugin" name for plugins on projects since they are not compatible to projects etc. out of here, not standalone. (unlike .cmd , .ps , .au3 etc)

I am sure you will be careful on your next posts.

:turtle:
« Last Edit: January 30, 2018, 04:01:34 AM by Lancelot »

Re: How to import a local Registry Key (C: drive) into Win PESE ?
« Reply #12 on: January 30, 2018, 02:14:22 PM »

bob.omb

  • Chef
  • ***
  • Location: USA
  • Date Registered: Jul 2017
  • Posts: 317
My question was, Before boot into WinPE, is there a way to export the key from C drive and import into WinPE.

Noone has ever done it that I have seen.  From my understanding the registry loads before anything else can run.

If you wanted to run something before WinPE runs that is a different arena, and in that arena i assume registry tools may not exist to read from one and write to another.

There is no ready solution available but if you work on something like this it would be helpful for the community..

Re: How to import a local Registry Key (C: drive) into Win PESE ?
« Reply #13 on: January 30, 2018, 03:06:25 PM »

topgundcp

  • Jr. Chef
  • **
  • Location: San Jose, California
  • Date Registered: Oct 2015
  • Posts: 67
My question was, Before boot into WinPE, is there a way to export the key from C drive and import into WinPE.

Noone has ever done it that I have seen.  From my understanding the registry loads before anything else can run.

If you wanted to run something before WinPE runs that is a different arena, and in that arena i assume registry tools may not exist to read from one and write to another.

There is no ready solution available but if you work on something like this it would be helpful for the community..
@Bob.Omb
Indeed the answer that Lancelot gave above is exactly what I was looking for. Using letterSwap solved the problem. I was annoyed that each time I boot into WinPE, The drive letters of the devices (HD/SSD/DVD ...)  were changed randomly. letterSwap was put in the registry as RunOnce at WinPE startup, Read the registry from Host OS and reassign the Drive Letters to match the host PC. Anyway, thanks for your help, it's just a misunderstading between my question and your answer.

@Lancelot,
Thank you for the solution, when adding letterSwap to the project, The Drive Letters synchronized correctly except one ie. I have a 32GB SDRAM plugged in and assigned it to drive letter Z. Somehow, letterSwap does not like this letter and re-assign it to a different one. If I went back and re-assign to a different letter ex. P then everything mapped correctly.

Thank you and greatly appreciated.
« Last Edit: January 30, 2018, 05:53:35 PM by topgundcp »

Re: How to import a local Registry Key (C: drive) into Win PESE ?
« Reply #14 on: January 30, 2018, 07:59:03 PM »

bob.omb

  • Chef
  • ***
  • Location: USA
  • Date Registered: Jul 2017
  • Posts: 317
It should be fair to go on the assumption that you already know how to use a registry editor. 

https://www.youtube.com/watch?v=DkLwsXPq6fM  <=== How to export a registry key into a .reg file

As I said before what you are trying to do will not work well at all.  Try using the Letterswap Plugin or CD X: Y: plugin.  <=====  :confused: :confused: :confused:

 :lol:
« Last Edit: January 30, 2018, 08:02:17 PM by bob.omb »

Re: How to import a local Registry Key (C: drive) into Win PESE ?
« Reply #15 on: January 31, 2018, 06:15:15 AM »

Lancelot

  • Gena Baker
  • Grand Chef
  • *****
  • Date Registered: Sep 2010
  • Posts: 7781
*
@Lancelot,
Thank you for the solution, when adding letterSwap to the project, The Drive Letters synchronized correctly except one ie.

I only re wrote more clear what bob.omb wrote before which you seem to miss:
Try using the Letterswap Plugin or CD X: Y: plugin.  <=====  :confused: :confused: :confused:


*
assigned it to drive letter Z. Somehow, letterSwap does not like this letter and re-assign it to a different one. If I went back and re-assign to a different letter ex. P then everything mapped correctly.
There are some exceptions on both plugins
X: -> since WinPE default
Y: Z: -> used by different plugins
+ Y: popular letter for CDDrive ( %CDDrive% )
+ Z: popular letter of mountdrive (on cases where .img .wim etc. mounted during boot on PE)

LetterSwap and MountedDevice do not break such cases.

That is the reason Z: did not work on your side.

PS:
I will write info on both plugins interface when time found ....

*
when adding letterSwap to the project,

LetterSwap is default enabled on All SE & Gena Projects

Being very picky, We only add The Most Useful things to projects defaults.
Still Giving the option to enable disable.


:turtle:

Re: How to import a local Registry Key (C: drive) into Win PESE ?
« Reply #16 on: February 03, 2018, 05:47:05 AM »

Lancelot

  • Gena Baker
  • Grand Chef
  • *****
  • Date Registered: Sep 2010
  • Posts: 7781
PS:
I will write info on both plugins interface when time found ....

I only add info to "MountedDevices Host" plugin

"LetterSwap" plugin already provides info about exceptions.

@topgundcp
First Better read interface and if provided "Read Me" documents on plugins. They will give info about most asked questions.

And If you had first test default project, you would not even open current topic,
So be careful about what you disable or change at default project settings.

:turtle:

 

Powered by EzPortal