Jump to content

How to read computer name from hard disk from WinPE


abcram

Recommended Posts

 

->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
Link to comment
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

Link to comment
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

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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