6 Replies Latest reply on Jul 10, 2018 11:35 AM by phoffmann

    [UTILITY][OCT-26-2012] CompName.exe - Replace ComputerName in Unattend XML

    JSMCPN Expert

      In response to this Community thread, I have created a tool that will modify the ComputerName value in a Sysprep Unattend XML file after being injected during WinPE Provisioning.


      The purpose of this tool is to eliminate the need to chose between automatic and manual computer naming when injecting an Unattend XML.




      CompName.exe N "C:\Path\To\YourUnattend.xml"


      The first command line argument is the number of seconds to wait before the tool exits and makes no modifications to the Unattend XML.

      The second argument is the path to the Unattend XML you wish to modify.  You must wrap this string in quotes, even if there are no spaces in the pathname.

      Both arguments are mandatory or the tool will default to 300 seconds and "C:\Unattend.xml"



      In a Provisioning template, make a new Action of the type "Execute File" and have it execute CompName.exe.  Supply the number of seconds and the path to the newly injected XML as the command parameters.

      Place this action directly after the existing Inject Script action in your template (or any other point after the Inject Script action, but before the system boots to the new image)


      ** In the ZIP file there is a _Demonstrate.bat that runs the tool against a sample Unattend XML file so you can try it out before putting it into LANDesk.





      How it works:


      1 - In WinPE, a Provisioning action launches the tool and waits a configurable number of seconds before moving on.



      2 - Supply a computer name


      3 - Script checks the hostname length and illegal characters


      4 - Once validated, script displays old name and new name.


      Unattend XML before:



      Unattend XML after!




      Application exit codes:

      2System cannot find the file specified (Specified Unattend XML does not exist)
      13The data is invalid (Failed to update Unattend XML)
      1223The operation was canceled by the user
      10022An invalid argument was supplied (Command line arguments missing or syntax error)




      I look forward to your feedback!


      Jesse McCoppin