This is the purpose of the command line arguments to the register
call of the agent updater. If the hostname cannot be derived from -H %COMPUTERNAME%
you just let it out completely and the registration process will ask for the hostname interactively.