Changing SID of cloned VMs

The fastest way to build a larger virtual environment (either test or production), is to install one VM and then clone it. This process is not the same for every environment. Additionally, it depends on the mechanism of the VM cloning process.

Additionally, every computer in the AD domain has its own identification. This identification is not its name. The computer name is useful for us. Moreover, this identifier must be unique.

On the machine level, every computer is identified by a unique value; named Security ID or SID. SID is calculated in the process of the installation of every Windows machine. Whether the computer is part of the workgroup (or it’s just a stand-alone computer), the value of SID is not crucial.

We’ve just discovered a potential problem. Whenever we need to build the AD domain, we need to have machines with different SIDs. Even more, when we build our virtual lab in Oracle VirtualBox (VBox), the clones will always keep the old SID from the original machine.

I discovered this problem preparing an article about remote administration and NIC teaming. Even better; I found the solution for this situation. So hold your breath and keep reading.

 

Joining VM to the domain

I needed at least two servers for my scenario. That’s not a problem with VBox VMs. I have installed one VM under Windows Server 2012 R2. I just need to make two linked clones and to save the precious disk space. My SSD drive is limited in size.

I made two VMs. The first became the AD domain controller server. When I tried to add the second machine into the domain, I faced the error. The SID of the domain (i.e. the domain controller) is the same as the SID of this VM.

01 - add new VM to the domain

If you check this message, you will see that you have the solution right in front of you. We need to run the tool named SysPrep. The SysPrep (or System Preparation) tool should sounds familiar to every seasoned Windows admin.

Yes, with the SysPrep tool we can delete the SID and all other settings, leaving the machine in an uninitialized state. The machine will be initialized on its first run. This mechanism allows admins to clone both physical and virtual machines easily.

Don’t forget to check the bottom-right corner of this screenshot (above). Our VM has 175 days left until expiry of the evaluation license.

 

The SysPrep tool

The SysPrep tool is located on the path %systemroot%\System32\SysPrep. In most cases, this is equivalent to the path C:\Windows\System32\sysprep. You have this tool in the Windows 7 and later workstations, GUI versions of Widows Server, and also on the Core version.

02 - SysPrep tool

Locate the SysPrep tool and run it as administrator. After a while, the application window will appear on the screen. In the Core version just type the command. The rest is the same.

clip_image005

Leave the System Cleanup Action drop-down menu on the option Enter System Out-of-Box Experience (OOBE). We want to clean all personalized settings of the machine.

However, we want to return this machine to an uninitialized state, as we just installed it. Therefore, tick the checkbox named Generalize.

The third option depends on your preferences. If you only need to clear the state on this machine, you will probably need to reboot it and continue to work. However, when you want to reset your master machine, you will need to shut it down after this process finished.

In this scenario, I only needed reinitialize this VM and I clicked on the button [ OK ]. The SysPrep tool will start. The rest of the process is automated and you can’t cancel it.

clip_image006

The first phase is the cleanup phase, where settings will be cleared. The second phase will perform generalization (re-initialization) of the machine.

clip_image007

After a while, our machine will reboot.

 

Re-birth of our server

My VM for the second server rebooted and started up. The first screen is usual for the Windows Server 2012 R2 boot sequence; then came the pleasant surprise.

06 - Checking devcices after reboot

Windows Server discovered that its device database is empty, so it started to search; the system now needs to detect all existing hardware.

One significant advantage here is that we may have a larger pool of device drivers, especially those for VBox integration. SysPrep will delete personalization and settings, but not the files on the disk.

08 - Server is now in domain

When server finished with initialization (during which you need to specify again the admin’s password), we can proceed to join the domain.

 

Server is in the domain

Before we continue, please, once more check the bottom-right corner. We have 180 days left. This proves that our server is completely reinitialized, as if it’s just been installed. That also means that any previously installed application needs to be reinstalled.

I again changed the server name to SERVER02 and joined it to the domain. Then I proceeded to the test scenario.

As you can see, this small yet powerful tool can be very useful. You should perform generalization of the VM template after the installation. Then, every new VM based on that template will be different from any others. Although you need a few minutes more to setup every new VM, that short time will be of great benefit later.

Stay tuned.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s