meph’s blog

2010/08/26

Boot DBAN with WDS

Filed under: Client Management, Software — Tags: , , — Michael @ 13:34

1. Download DBAN (Darik’s Boot And Nuke) here
2. Download Syslinux here
3.  Create a new directory ‘DBAN’ under \REMINST\Setup\German\Images on your RIS/WDS Server (I’m working on a German system, so change language appropriately)
4.  In this directory, create a new folder ‘I386’
5. In the I386 directory, create a ‘pxelinux.cfg’ and a ‘templates’ folder
6. Extract the file pxelinux.0 (found in the syslinux-4.02.zip under the folder ‘core’) to the I386 directory
7. Extract the file ISOLINUX.CFG from the DBAN ISO, rename it to ‘default’ and put it in the pxelinux.cfg subdirectory
8. Extract the file DBAN.BZI from the DBAN ISO and put it in the I386 directory
9. Create a file called dban.sif in the templates subdirectory and put the following content in it:

[OSChooser]
Description =”DBAN”
Help =”Darik’s Boot And Nuke”
LaunchFile = “%INSTALLPATH%\%MACHINETYPE%\pxelinux.0″
ImageType =Flat
Version=”5.0”

So, it should look now like this:

10. Restart the RIS/WDS service and try it out!

Advertisements

2009/10/22

RIS/WDS – post installation script

Filed under: Client Management, Deployment, Scripting, Windows — Tags: , , , , — Michael @ 14:34

In the last weeks I did a lot in order to optimize our workstation deployment process. Well, we have been using RIS/WDS for a long time now, but we always had to do several things manually after the rollout, e. g. moving the computer object in another OU, changing the computer description to the “owner” of the PC and so on. I knew that most of this is scriptable, but never found the time to get my hands on it.
At first I had the problem that the autologon of the local administrator after applying the riprep image never worked, because the local admin account had been disabled in the installation I captured (with the local admin disabled, the autologon setting which is configured in the .sif file won’t work and so I can forget the GuiRunOnce section :(). I thought that I can fix that by editing the according riprep.sif file but it didn’t work at all (keyword: DisableAdminAccountOnDomainJoin). I finally fixed that by putting

net user Administrator /active

in the Cmdlines.txt (indeed this is quick and dirty but it works for the moment and I have to make a new image next month anyway).
So, the base for my postinstallation script was developed and I began with the script. It should do the following:

– setting the computer description (or comment) under Control Panel – System
– ask the admin for the NETBIOS name and change it
– set the description of the computer object in AD
– move the computer object in the correct OU

After reading the first point you’ll probably ask “Why the hell don’t you set the correct computer name at the time you install it?”. It’s simple: Our computernames are in the form pc-xxx-##. The xxx is the short form of the department where the computer belongs to and ## is a number.  While the installation of the computer the admin maybe doesn’t know for which department the computer will be, so WDS just chooses a more random name (pc1, pc2, pc3, …).

The computer description is stored unter HKLM\System\CurrentControlSet\Services\lanmanserver\parameters\srvcomment. I do that in the script by importing a key (overwriting the old):

set /p description=Description of the computer:
reg add HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\lanmanserver\parameters /v srvcomment /d "%description%" /f

Well, this is simple. I’ve found a hint here.

Let’s continue with changing the Netbios name of the computer. As you probably know this can be done with netdom.exe, which is part of the Windows XP support tools. I have already written about it in another post. For a description how to use it I suggest you read this article. Instead of simply changing the computer name I want to check first if a computer account with the same name already exists in the directory.  For this I use the dsquery command. At that point I came across my first “problem”. First of all this command (and also the other ds* commands like dsadd etc.) isn’t available under Windows XP and this command doesn’t support a parameter to pass a username and a password (in order to run the command as an user who has the permission to change AD objects) unlike Netdom, which has the /userd and /passwordd parameters. I realized that it could be done by running dsquery remote with psexec:

\\server\util\psexec.exe -accepteula \\server -u companydomain.de\Administrator -p password cmd.exe /c dsquery computer -name %newname% ^| dsget computer

The variable newname is filled by another set /p-line in my script, which asks the admin for the new name. Please notice that you have to escape the pipe by adding a ^ in front of it!

In the case that dsquery finds a computerobject with this name the errorlevel is 0, otherwise… well, I guess you know how to script that 😉
When an object with this name has been found, I want to offer the option to delete the old computerobject. Deleting is done with piping the output of dsquery to dsrm:

\\server\util\psexec.exe -accepteula \\server -u companydomain.de\Administrator -p password cmd.exe /c dsquery computer -name %newname% ^| dsrm -noprompt

Remember that it takes some seconds until the changes take effect and the object is deleted in AD, so better add a little sleep (for example:  ping localhost -n 30 >NUL or something) after that line. At last the actual renaming is done with:

\\server\util\psexec.exe -accepteula \\server -u companydomain.de\Administrator -p password  cmd.exe /c start/wait \\server\util\netdom.exe renamecomputer %oldname% /newname:%newname% /userd:companydomain.de\Administrator /passwordd:password /force

Of course it is necessary to reboot the computer after renaming it, but we don’t do it yet. Before we care about the other two points.

The description of the computerobject in the directory can be modified with dsmod. This is simple too, we take the value of %description% and use it:

\\server\util\psexec.exe -accepteula \\server -u companydomain.de\Administrator -p password cmd.exe /c dsquery computer -name %computername% ^| dsmod computer -desc "%description%"

For moving the computerobject to another OU I wrote a batch, moveou.bat with the content below:

@echo off
REM Move computerobjects to according organisational units
for /f "Tokens=*" %%s in ('dsquery computer "OU=Departments,DC=companydomain,DC=de" -scope onelevel -name pc-dep1*') do (DSMOVE %%s -newparent "OU=Department1, OU=Departments,DC=companydomain,DC=de")
for /f "Tokens=*" %%s in ('dsquery computer "OU=Departments,DC=companydomain,DC=de" -scope onelevel -name pc-dep2*') do (DSMOVE %%s -newparent "OU=Department2, OU=Departments,DC=companydomain,DC=de")
for /f "Tokens=*" %%s in ('dsquery computer "OU=Departments,DC=companydomain,DC=de" -scope onelevel -name pc-dep3*') do (DSMOVE %%s -newparent "OU=Department3, OU=Departments,DC=companydomain,DC=de")

You have to use ‘for’, because piping more than one result from dsquery to dsmove doesn’t work (usually there should be just one object to move, but who knows). By the way, the OU “Departments” is the OU where RIS/WDS creates the computerobject while installation.

I put the batchfile on the same network share as my other utils. In the mainscript I added a line

\\server\util\psexec.exe -accepteula \\server -u companydomain.de\Administrator -p password cmd.exe /c start/wait \\server\scripts\moveou.bat

So we are finally done with the script. The last thing we have to do is rebooting the computer by

shutdown -r -t 0

Of course you can put a lot more things in the script, e. g. software installations using msiexec etc.
Thank you for reading this post and sorry for my bad English and the many line wraps 😉

2009/07/24

Acronis Rescue Media Builder and WDS

Filed under: Software, Windows — Tags: , , , — Michael @ 11:40

Yesterday I tried to create a boot image with Rescue Media Builder (part of Acronis True Image Echo Workstation) on our WDS-Server for desaster recovery purposes. Unfortunately this didn’t work. I got this significant error:

rescue_media_builder

After checking permissions on the WDS-Server and doing some more testing I searched on Google for this error. I came across this Acronis KB article, saying that WDS has to be in Legacy Mode for Media Builder to work. So I switched with WDSUTIL /Uninitialize-server in Legacy mode and tried again. I received the same error…
Finally I got in touch with the Acronis support. Below a part of the chat transcript. (I’m M, the support employee is S. Sorry, just in German.)

[11:37:20] M: Hallo. Ich habe folgendes Problem mit dem Media Builder:
[11:37:56] M: Waehle ich als Ziel unseren WDS-Server (befindet sich im Legacy-Modus), erhalte ich die Fehlermeldung “Erstellung des Mediums fehlgeschlagen”
[11:38:05] M: Fehlercode 0x0.
[11:38:16] M: Hierzu finde ich nichts in den Supportforen.
[11:38:54] S: Ich beantworte Ihre Fragen gerne.
[11:39:10] S: Leider unterstützt Acronis aktuell nur RIS. Der Nachfolger WDS wird aktuell noch nicht unterstützt
[11:40:04] M: Das steht hier aber anders: http://kb.acronis.com/content/1753
[11:41:22] S: Einen Moment bitte
[11:46:07] S: Nein, die Entwicklung hat noch nicht geantwortet. Soweit wir informiert waren, wurde WDS bisher auch im Legacy Mode nicht unterstützt.

Okay… this is strange. WDS currently not supported? Then why the article in the knowledgebase? Well, one of both statements has to be wrong. The support guy promised me that Acronis development will contact me with detailed information (and perhaps a new build of Rescue Media Builder, officially (?) supporting WDS as target :S)

I’ll update this post as soon as I know something new 😉

(Btw. yes I know, there are cool free alternatives like DriveImage XML with Bart PE support… 😉

UPDATE

A support technician contacted me yesterday and told me to install the Acronis PXE-Server included in Acronis SnapDeploy and set it as target for media builder. I didn’t try this, but I guess I then have to stop the Acronis PXE service each time I want to use WDS :S

UPDATE 2

Acronis support sucks. After dozens of mails without any solution for the problem, I ran across the news that a new product (“Backup & Recovery”) replaced TrueImage. Luckily we were able to upgrade our license and with B&R’s media builder you can also access WDS-servers…

Blog at WordPress.com.