Use the setcomputername task twice
Good morning all!
I should run the setcomputername SDA task twice during a scripted installation. Indeed, this would allow me to be able to recover either a name given by the administrator or a name found in the database.
The tasks therefore follow this order:
Get Computer Name With Timeout prompts the technician for a name. If the technician does not want to give a name, after 2 minutes he returns a random number.
Set Computer Name With K1 DB looks up the computer name in the K1 database.
Set Computer Name - Random retrieves the name given by the technician. If this name is random, it will not be used and we will therefore keep the name entered in the second step (the old one).
However, I have a problem: the file in which the name the technician left is cleared by the second step (Set Computer Name With K1 DB).
By using the switch /debug, I am offered if I want to delete this file. Is there a way to achieve this with commands? I did not find anything on the subject in the documentation.
I also thought about using the switch /drive:c for steps 1 and 3. The file is still deleted by the 2nd step.
So A diskpart will most certainly wipe the data on C:
According to the documentation
How getcomputername.exe works:
1. The active nic is found and the MAC address recorded.
2. The registry and loaded and we read the computername of the workstation
3. If /dialog was chosen, this name is entered in the dialog by default, if no name found then we use *,
whatever is in the dialog box at the time OK is clicked, that will be used as the computername
4. A file is created on the T: drive (petemp) with the MAC address as its name.
5. The computer name is recorded inside the file in step 4.
So it *should* be using T: to store the name. Are you able to run the /log and provide it? It may have further clues as to what is happening.
Also the blog post could be a good place to ask this question on here: Article: Get/Set ComputerName (itninja.com)