cschneegans / unattend-generator

.NET Core library to create highly customized autounattend.xml files
https://schneegans.de/windows/unattend-generator/
MIT License
659 stars 60 forks source link

Request - Dynamic Device naming #73

Closed hipsoppel closed 1 month ago

hipsoppel commented 1 month ago

Would it be possible to setup dynamic naming in the base unattend file without the use of custom scripts section. For an example, make the computer name dependent of variables pulled from BIOs keys ie serial or asset tag. Doing it through scripts is possible but cumbersome due the requirement of restarting the device before the name is set.

I also might just be missing a simple solution otherwise

cschneegans commented 1 month ago

I would love to provide a mechanism to set the computer name during Windows Setup. That sounds simple enough, but I have been unsuccessful so far.

Calling Rename-Computer in a script placed in the Scripts to run when the first user logs on after Windows has been installed section works reliably – in a manner of speaking, this is after Windows Setup, not during. A sample script was just posted in #70, but unfortunately this will require another reboot.

cschneegans commented 1 month ago

Just added a new setting Provide a PowerShell script to set the computer name dynamically, which you may find interesting:

image

hipsoppel commented 1 month ago

Awesome! Thanks a ton. This is working almost perfectly. My only follow up is about the character limit. The current logic I have written is about 2500-3000 characters. Could the limit of 999 be increased ?

cschneegans commented 1 month ago

There is no length limit for any of the textarea inputs. The only limitation is that the resulting URL must not be longer than 64k characters, as this is the limit for the .NET System.Uri class, which I employ.