I'd recommend leveraging something like UI++ https://uiplusplus.configmgrftw.com/
Demo: https://docs.recastsoftware.com/ConfigMgr-Docs/Community-Tools/Community-Tools-UI%2B%2B.html
Once you grab the serial number, you could use that to pre-populate the computer name dialog box, which is similar to the scenario that is covered in that demo link.