After changing the name of a Windows computer, you might find yourself needing to retrieve its previous name (hostname). This can be accomplished by accessing the Windows registry.
To locate the old computer name, navigate to the registry key located at HKLMSOFTWAREMicrosoftSchedulingAgent. You can either manually check the value of the OldName parameter using the Registry Editor, or use PowerShell with the following command:
(Get-ItemProperty HKLM:SOFTWAREMicrosoftSchedulingAgent).oldname
This registry key holds the computer name assigned during the initial installation of Windows. However, it’s important to note that any subsequent renames will not be reflected here.
If you require a full history of a computer’s hostname changes, this information can be found in the Event Viewer logs, specifically by looking for host rename events. Here’s how to do it:
- 
Open the Event Viewer snap-in (
eventvwr.msc). - 
Expand Windows Logs and select System.
 - 
Filter the event log by Event ID 6011.
 - 
Review the latest event, which will have a description detailing the previous and current names:
The NetBIOS name and DNS host name of this machine have been changed from WIN10-OLD01 to Win10-NEW01. 
You can also list all hostname change events directly from the Event Viewer log using PowerShell:
Get-WinEvent -FilterHashtable @{ LogName = 'System'; Id = 6011 } | Select-Object TimeCreated, Id, Message
In cases where the Windows Event Logs have been cleared or newer events have overwritten the old ones due to log file size constraints, you can still find hostname change history in the C:WINDOWSDebugNetSetup.LOG file. To swiftly search for relevant changes to the hostname or domain status, you can utilize the Select-String cmdlet as shown below:
Select-String C:WINDOWSDebugNetSetup.LOG -Pattern "NetpValidateName"
This method offers a comprehensive approach to track computer name changes on a Windows system.
