Great build script. I wanted to make you all aware of a problem I ran into that took a while for me to track down.
When I built my dev server I called it \\Sharepoint2010Dev - which windows server 2008 allowed me to do. I noticed after the build script I was having problems with search and I noticed that the servername was referenced
as \\Sharepoint2010D (noticed that the server name is truncated from the actual netbios computer name). In looking in your scripts you reference the $env:COMPUTERNAME operating system environment variable.
When I do a "set" command on this system I noticed that it is listing the truncated 15 character computername. Since the computername is truncated and invalid the hostname does not resolve on the network and hence causes a variety of issues.
I wanted to recommend in the build script that you check to ensure that the $env:COMPUTERNAME environment variable actually is correct and matches the real netbios name of the computer.
Thanks for all the work you put in on this script