Tag Archives: Scripting

How to install server 2003 r2 disk 2 Silently.

During out Enteo rollout we were faced with a problem of how to either A: stop server 2003 from prompting us to install cd or B: just install the useless cd to register the operating system as R2. After a bit of digging, and some help from a very friendly consultant called Hans from Frontrange, we came up with the following method.

You need to create a .CAB file of the entire cd of r2, extract it using extract.exe to the root of the c drive, run the installation then delete the extracted files (if you wish).

Sounds simple eh? you have no idea how much of a pain in the backside this was. Firstly ill put this out there for anyone who tries to use the CRAPPY utilities by microsoft for creating cab files, DONT BOTHER. After 2 hours of tinkering and scripting the steaming pile of useless cab files was quite proportionate.

To answer this question to anyone googling, here it is:

How do i create a cab file from a source folder? Use tugzip. One problem with tugzip and cabs its seems to hang on 100% with the only option to cancel, this seems to be normal, so just wait for 2-3 mins on 100% then cancel away.

The only problem here is that if you have the files above the c: prompt the files will not install correctly, tugzip remembers the path of the zipped files after the drive prompt, so if you zipped c:mydocs2003r2 extract will put them back in that exact folder.

Heres what you do:

  • copy your installation files to a folder anywhere on your disk.
  • use the subst command to map the folder to the root of a free drive (subst z: c:mydocs2003r2)
  • now browse to the z: drive and use tugzip to create your archive file.

you can of course bypass all the above if you place the cd in the drive and use the cd’s drive letter ;) its amazing how simple an answer that WOULD have been if i had thought of it.

Once you have done that, its simple scripting time!

copy servernamesharenameextract.exe c:
copy servernamesharename2003r2cd2.cab c:
c:extract.exe /E 2003R2CD2.cab /L c:2003R2CD2 /y
C:2003R2CD2CMPNENTSR2setup2.exe /q /a /p:xxxxx-xxxxx-xxxxx-xxxxx-xxxxx /sr
rd c:2003R2CD2 /s /q
del extract.exe
del 2003R2CD2.cab


your server (post reboot) should report server 2003 r2 correctly. Might be worth noting that server 2003 enterprise and standard do NOT share the same cd. So if you have an environment with both, time to repeat the above steps for the other cd.

Ntbackup part: 3 Rolling out the job.

In the previous two articles I have covered off how to backup your servers to one file share and script a scheduled task to automate the process. Now what we have to do is copy the backup.bat out to each C: drive of every server, and create our scheduled task on each server.

There are many reasons I have decided to do this process manually. Leaving the backup.bat on the c: drive will allow for easy maintenance of the backups on each server for adding/removing backups. The second reason is the servers you wish to backup will need different drives backed up!

Once you have copied the custom backup.bat to the c drive of all your servers its now time to schedule the task…this is a simple and painless script that can also be reverse engineered to delete the job.

Place all your server names in a text file called servers.txt one per line and place it to the c: drive root e.g. c:. Once created, kick off a CMD prompt as a user with admin rights on the servers.

Now using the for command:

FOR /F “tokens=* delims=: ” %%i in (c:servers.txt) do schtasks /create /s %%i /u domainusername /p password /tn Server-Backup /tr “c:backup.bat” /sc daily /st 19:00:00

This will contact each server, one by one, and create your schedueled task to run every day at 7pm. Make sure to change the domain username and password to match your own environment.

Agus sin é.

NtBackup Part:2 schedueling a task via cmd.

As part of an ntbackup script i began recently, I needed to look at how to schedule tasks from remotely. I had some experience using at.exe but seeing as schtasks seems to be the new tool i decided to give it a lash.

Almost immediately i ran into problems, if i was to specify a username and password for the job to run as, the script demanded a system name… why ask for a system name if you want to run it locally i wondered, but with using the %computername% variable it allowed me to run this locally.

schtasks /create /s %computername% /u domainusername /p Password /tn Server-Backup /tr “c:backup.bat” /sc daily /st 09:00:00

the above schedules backup.bat to run as whatever user you specify, it will display as “Server-Backup” in scheduled tasks and will run daily for ever.

Below is an example of what you should see in scheduled tasks:

Check the next post for information on how to roll this out to multiple servers.

Ntbackup Part 1: Scripting Nt backup

With the cost of newer backup software being very pricey to the small organization, its a wonder that the beautifully simple solution that is NTbackup has been overlooked so many times!

Nt backup isn’t pretty, it can be a little temperamental and requires you to keep on top of it at all times… but so is every other product on the market.

I have chosen to keep a network location for all the backups you will create for your servers, this will aid in organizing log files, and backing up each daily backup from one resource. There are so many options available, with incremental s, dailies, full and shadow copies i have decided to keep it simple with full backups daily, but once you have an idea of how the script works theres nothing stopping you from configuring it to suit yourself.

To kick off the guts of this three parter I’ll start with writing the script you will need to backup your infrastructure to a single disk space.

Continue reading