Den 03.11.12 16:50, skrev Doug:
> I have a Win7 unattended going.  Well, kind of.
>
> I boot from a USB drive with an unattended xml file on it, which does
> the basic install and then starts a modified "apps only" type of install
> after windows is done.

We prefer to use PXE boot, I got PXE boot to work using the instructions 
in that link I posted originally 
(http://www.mail-archive.com/unattended-info@lists.sourceforge.net/msg09116.html).


> I have to create/modify the unattended xml by hand every time - it has
> my computer name, domain, etc, as well as the main unattended bat file
> tor run.  I also create a user-pc specific .bat file that contains all
> of the todos for the user and pc type.

I also somehow managed to hack together a batch-script which look ups 
the DNS hostname using ipconfig and nslookup (had to copy nslookup from 
the Windows 7 install image) and creates a modified unattended.xml:
==========================
@echo off
:: Template for the unattended.xml.
set UNATTENDED_ORIG=Z:\site\win7_unattended.xml
:: Location for the modified unattended.xml:
set UNATTENDED=X:\unattended.xml

IF EXIST %UNATTENDED% DEL %UNATTENDED%

echo Trying to find computer name...
for /f "tokens=2 delims=:" %%f in ('ipconfig ^| find "IPv4 Address"') do (
   set IPADDR=%%f
   goto foundip
)

echo ERROR: Couldn't find IP address using ipconfig...
goto :finished

:foundip
echo Found IP address: %IPADDR%
:: nslookup in WinPE looks like this:
:: > (null)  COMPNAME.domain.tld
for /f "tokens=3 delims=). " %%f in ('echo server %IPADDR% ^| 
Z:\dosbin\nslookup.exe ^| find "> (null)"') do (
   set HOSTNAME=%%f
   goto :foundhost
)

echo ERROR: Couldn't find hostname using nslookup...
goto :finished

:foundhost
echo Found machine name: %HOSTNAME%
echo Genererating %UNATTENDED%...

:: COMPNAME should be whatever you have set the "temporary" computer
:: name to in your unattended.xml template.
FOR /F "tokens=1 delims=;" %%l in (%UNATTENDED_ORIG%) do (
   IF "%%l"=="            <ComputerName>COMPNAME</ComputerName>" (
     echo             ^<ComputerName^>%HOSTNAME%^<^/ComputerName^> >> 
%UNATTENDED%
   ) else (
     echo %%l >> %UNATTENDED%
   )
)

echo Starting Windows 7 installation...
Z:\os\win7\setup.exe /unattend:%UNATTENDED%

:finished
=====================

I had to use nslookup because a lot of other methods (ping, etc) returns 
the temporary local hostname set by WinPE instead of the hostname in the 
DNS... Maybe someone have a better solution for that.

In any case this script is quite dependant on spaces in the XML-file, 
output from the iplookup/nslookup commands, and language differences in 
your WinPE boot, so you might need to modify the script to work for you.


> It's been a couple of years since I set it up, and I know I ran into
> several problems, mainly around running scripts from a share that was in
> my windows domain and a computer that wasn't - or vice versa.  I created
> a special account in my domain to do the install with.  And I ended up
> breaking the pre.bat into two parts with perl being installed between them.

I don't know if this is the same problem that you had, but I also had 
some trouble getting Windows 7 to run the unattended Perl scripts 
because it would pop up the "security warning" dialog. However I got it 
to not show those warnings by adding ".exe;.pl" (and a bunch of other 
filetypes) to the LowRiskFileTypes registry setting at 
"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Associations".
 
I just unset it after installation.

After I did that, most of the application installs for unattended 
actually seemed to work! I just had to tweak a few of them to work, 
mostly because some had trouble with file copying and %PROGRAMFILES% vs 
%PROGRAMFILES(x86)%.

But there are still a few things that doesn't work, f.ex. autolog.pl 
doesn't seem to work so I have to input username and password after each 
todo.pl reboot.


> User has to make a WinPE boot disk and boot from it.
> Map \\ntinstall\install to Z:

I managed to make the startup script (startnet.cmd, this need to be 
added to the WinPE boot.wim file) connect to the network share and start 
the installation by itself. The script mostly just uses the same code as 
mapznrun.bat for trying to connect 20 times, and once connected runs a 
bat file from Z:\bin to do the rest of the work.

I'm sure you could do this on the USB too! (Though you'll need to have 
username and password in the script, preferably use a user which only 
has read access to the install share.)


> I'm not very experienced with windows scripting, and but I imagine that
> several of the things I do in the unattended (join domain, set local
> admins, rename pc) could be done after the install via todos.

Though I managed to get the computer name automatically using DNS 
lookup, I still haven't been able to get automatic domain join to 
work... (We never got it to work with Windows XP either.)


Maybe I should make a more thorough guide. But as I mentioned, there are 
still a few problems that I'm trying to work out before it works completely.

Johan Ho

------------------------------------------------------------------------------
LogMeIn Central: Instant, anywhere, Remote PC access and management.
Stay in control, update software, and manage PCs from one command center
Diagnose problems and improve visibility into emerging IT issues
Automate, monitor and manage. Do more in less time with Central
http://p.sf.net/sfu/logmein12331_d2d
_______________________________________________
unattended-devel mailing list
unattended-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/unattended-devel

Reply via email to