Jump to content

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

Posted

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

Posted

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.

Posted

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

Posted
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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...