Customizing Virtual Machines

Here you will find general information about customizing or updating virtual machines. If you want to create a completely separate, non-template Virtual Machine, which we advise against, please look at this article: Erstellen neuer Virtueller Maschinen. In case you just want to update Windows, you will find information here: Kurzanleitung.

Importing Updates

Please make sure that virtual machines created by you are updated from time to time and especially directly when serious security vulnerabilities occur.

Importing Windows Updates

In order to import Windows updates, you must first reactivate the necessary service, as this has usually been deactivated beforehand in order to avoid unnecessary notifications and updates in the bwLehrpool operation.

Open an Admin Console1) and execute the following command:

sc config wuauserv start= demand

Then find and install the Windows updates as usual. Depending on the length of time since the last update, searching alone may take some time. If you have installed all updates and restarted the VM, disable the service again:

sc config wuauserv start= disabled

Importing Linux Updates

Please use the update options provided by your distribution (zypper, apt-get, yum, checkupdates etc.). Also make sure to deactivate any third-party updater a la apper, packagekit-autoaupdate and the like under Linux.

Update Firefox

To update Firefox, the file “C:\Program Files\Mozilla Firefox\defaults\pref\autoconfig.js” must be temporarily moved, e.g. to the desktop.

This file loads a special configuration, which disables updates and annoying warning messages (“you have not used Firefox for a long time” etc.). Further information at Use in companies

After that, restart Firefox and let it auto-update. Once that is completed, move the autoconfig file back to the original location.

Installing Your Own Software

You are completely free to choose your software, as long as you do not need to purchase a licence. We recommend using free/open-source software when possible.

  • Disable updates, check for new versions of programs occasionally.
  • Install only required program parts, if possible

Turn off Unnecessary Services

The Device Optimization Tool (DOT) utility was created to easily disable unnecessary services. It is used for automatic optimization of Windows Virtual Machines for use within bwLehrpool. The utility should have already been run before or when the template was created, but re-running will not hurt, as sometimes services have been re-enabled. Please do this within your virtual machine and then restart the VM once.

VMware OS Optimization Tool

The VMware user community has created a tool that can be used to set Windows settings based on xml templates.

Microsoft's update policy, especially for Windows 10, is in some cases taking on extreme proportions. For example, a particular update installs a maintenance task that regularly reactivates the Windows Update Server. In the case of bwLehrpool this is undesirable.

Therefore we have created a template which can be used with OSOT to deactivate unnecessary services and tasks under Windows 10.

The tool is already in the templates under 'C:\bwLehrpool'. This can be started, the template loaded and executed. Alternatively, the step can also be performed directly in command line.

VMwareOSOptimizationTool.exe -v -o -t bwlp_Windows_10.xml

Release Disk Space

These points are not absolutely necessary and are worthwhile only after major changes or updates of a virtual machine. There is no need to run it after every change. Nevertheless, it is recommended to do this after extensive work on a VM.

Clean up the Hard Disk

cleanmgr.exe /sageset:1

Check all possible options

cleanmgr.exe /sagerun:1

On Linux, delete anything unnecessary from / tmp, things like package management caches.

Disk Defragmentation

A defragmentation of the hard disk is of course not always necessary. However, it offers advantages if the VM is to be scaled down later. A reduction can only occur if the occupied data clusters are collected at the beginning of the virtual hard disk or, in other words, the free space is at the end.

sc config defragsvc start= demand
defrag C:\ /H /U /V
sc config defragsvc start= disabled

For Linux VMs, use file system-dependent tools, such as e4defrag (for ext4 partitions).

Overwrite Free Space

Overwrite the free space with zeroes. On Windows we recommend the utility sdelete, which is already stored in the standard templates under C:\bwLehrpool\sdelete (otherwise, you can find it at SDelete):

sdelete.exe -z

On Linux you can simply use dd followed by rm:

dd if=/dev/zero of=/many_zeroes (… eventually outputs "Disk Full" or something similar)
rm /many_zeroes

Final Work

Finally, the virtual disk can be downsized. The path differs depending on the program used.


  • Click on the virtual machine, but do not start it. Select “Edit virtual machine settings” and click “Hard Disk” in the pop-up window, then click “Compact disk to reclaim unused space”.
    • Note: VMPlayer also offers the option “Defragment files and consolidate free space”. This possibility does not seem to be available for every virtual operating system, and the results are not always satisfactory.

VMware Workstation

The procedure is the same as with VMPlayer. You can also use the command-line tool vmware-vdiskmanager on some versions (see below).


Change to the directory of the vmdk file and type

vmware-vdiskmanager -k vmdk-filename.vmdk 

This action will take some time.


bwLehrpool-Suite: VM aktualisieren

Now you can upload your updated virtual machine. If you have only updated a virtual machine, it is recommended to use the “Neue VM-Verion hochladen” mechanism in the bwLehrpool-Suite in the VM area under the properties of the VM.

Analogous to the start button under Windows 7 (Start, “cmd”, [Ctrl + Shift + Enter ] in Windows 10, use the magnifying glass icon.