Type computer name in the search field that comes up
Hit the Enter button on your keyboard
Click See the name of this computer. The name is displayed in the Full Computer Name field
For Windows 8/8.1/10/11
Hit the Windows key on your keyboard
Type computer
Right-click on This PC
Select Properties The name is displayed in the PC/Computer name field.
If you are NOT able to log into the computer you can still check the computer name. From the login screen, opt to login as Other User. Inputting ".\" in the User Name field will display the name of the computer directly below the Password field.
Mac
Select System Preferences
Click on the Sharing pane.
Your computer name is listed at the top of the new window.