[Samba] Semi-automated cloning using powershell scripts

David Mathog mathog at caltech.edu
Tue Sep 7 14:43:33 MDT 2010

Just in case anybody else ever needs these, here are my semi-automated
powershell cloning scripts for Windows domain clients for Samba domain


They are not very polished, but do what I need, and could serve as a
starting point for other sites.  These have been tested only on XP SP3.
 These scripts do not use sysprep, so the clones end up with the same
SID, which apparently makes no difference whatsoever.  These only handle
pre and post cloning actions, not the actual cloning of the
template machine.  The scripts also disable/reenable Sassafras
KeyAccess, just in case any of you also use that.  If not, comment out
those parts.  Our clones are all identical machines -, major
modifications would be needed for cloning to heterogeneous targets.

For full details see the instructions file and look at the scripts
themselves.  One double click on the start batch file on the master
(template) machine removes it from the domain and sets it up for
cloning.  A scheduled task is created that runs at each boot, so that
the steps can be chained together without manual intervention.  After
the machine shuts down go ahead and clone it with your tool of choice,
being sure along the way to drop a machine_info.ps1 file into
C:\Cloning.  Then have the clones reboot (with WOL or as a reboot
when your cloning tool exits), and they will change their names, set
their IP addresses (we use static addresses), and finally rejoin the
domain.  There are a bunch of reboots along the way, but the scripts
trigger these by themselves so no administrative intervention is
required.  When finally done the scheduled task is removed and all
the clones shut down.  Status and other messages go to logfile.txt in
the C:\Cloning directory, so if something goes wrong, look there for


David Mathog
mathog at caltech.edu
Manager, Sequence Analysis Facility, Biology Division, Caltech

More information about the samba mailing list