Jump to content
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble

MSFN is made available via donations, subscriptions and advertising revenue. The use of ad-blocking software hurts the site. Please disable ad-blocking software or set an exception for MSFN. Alternatively, register and become a site sponsor/subscriber and ads will be disabled automatically. 


Sign in to follow this  
abcram

How to read computer name from hard disk from WinPE

Recommended Posts

Posted (edited)

 

->Need to retrieve PC name and later change back to the original name

Boot to Win PE (for Win 10 v1809 32bit)

Need a script that will run in WinPE and do the following:

Load the registry hive of the computer into WinPE

Get the computer name from the registry (probably HKLM\System\CurrentControlSet\Control\ComputerName\ComputerName)

Save the computer name to a temporary folder on the USB

Partion & format the drive then install the image (my process).

After Windows setup is complete, a new PC name will be generated, so  need an additional script to:

change the computer name back to the original name.

NOTES:

An underline will be used in the original name, so a warning about non-standard characters will be likely and a restart required for the name to change. 

When manually changing the name, the older process (like Win7) from Control Panel / System / Advanced System Settings / Computer Name tab / [Change] button works... but the simplified Windows 10 way (Setting / System / About / [Rename this PC]) does not allow the use of the underline in the PC name.

 

Edited by abcram

Share this post


Link to post
Share on other sites

Hmmm.

Have you tried via wmic?

https://www.windows-commandline.com/change-computer-name-command-line/

it still works (should) on Windows 10, where you have also the Powershell method available:

https://www.tenforums.com/tutorials/5174-change-computer-name-windows-10-a.html

Otherwise, if you really-really want to do it from the PE, try the Offline Registry Editor

http://reboot.pro/topic/11212-offline-registry-library/

http://reboot.pro/topic/11312-offline-registry/

http://reboot.pro/topic/18527-offlinereg/

jaclaz

Share this post


Link to post
Share on other sites

Is this for home or business use? If in an enterprise environment, I would query the asset management system for the old computer name and then use powershell to rename the computer. No entry into WinPE needed.

Share this post


Link to post
Share on other sites

Hi K-Mart yes its the enterprise environment Do you have the command to change or rename the computer from powershell

Share this post


Link to post
Share on other sites
2 hours ago, abcram said:

Hi K-Mart yes its the enterprise environment Do you have the command to change or rename the computer from powershell

I ALREADY posted a link to it:

https://www.tenforums.com/tutorials/5174-change-computer-name-windows-10-a.html

anyway:

https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/rename-computer?view=powershell-6

Example:

Rename-Computer -NewName "Server044"  -Restart

jaclaz

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...