VMM Library is the repository where are stored ISO, VHDX, answer files etc. This library is used by VMM to mount the ISO in a virtual machine, to deploy VM from VHDX or many others utilization. We will see in this topic how to manage multiple VMM library.
Create a VMM Library
To create a library, create a share of a folder. Mine is called VMMLibrary.
I set Authenticated Users to Read for the example. For production I recommend you to set Authenticated Users share permission to Full Control and manage access from NTFS permission.
Next add your VMM runAs account to Administrators local group.
Now that share is ready, you just have to add the library to VMM.
Add a Library to Virtual Machine Manager
To add the library to VMM, navigate to the Library tab and right click on Library Servers. Then click on Add Library Server.
Next select your RunAs account as below (that you have added to Administrators local group on your library server).
Next search for your library server from Active Directory. Mine is called vmlib01.
Then select the share which will be managed by VMM. I never add the default resources that useless from my point of view.
To finish adding the library click on Add Library Servers.
The PowerShell code:
$credential = Get-Credential Add-SCLibraryShare -Description "" -JobGroup "87854076-414a-4d64-abb2-b529ddcb5901" -SharePath "\\vmlib01.home.net\VMMLibrary" Add-SCLibraryServer -ComputerName "vmlib01.home.net" -Description "" -JobGroup "87854076-414a-4d64-abb2-b529ddcb5901" -RunAsynchronously -Credential $credential
Once the library is added, you should see under Library Servers.
As you can see in above screenshot, the objects are displayed twice: one from VMVMM01 server and one from VMLIB01 server. We will see after how to manage that. But before, we will assign libraries to host groups.
Assign a VMM Library to a host group
To assign a VMM library to a host group, open the Library tab and under Library Servers menu right click on a server name. Then select Properties.
I assign vmlib01 to Work host group and VMVMM01 to Home host group.
Now that library are associated with the host groups, it is time to manage equivalent objects.
Manage equivalent objects
Equivalent objects are used to say to VMM that two objects in the library are same. For example, you can see below screenshot where the same VHDX is located on each VMM Library server. These VHDX are marked as equivalent objects. When I use this VHDX on VM template, I select one instance of these equivalent objects. In this way, VMM will choose itself one instance on deployment.
This become beneficial when you assign VMM Library servers to host groups. If you deploy a VM from a template where the VHDX are marked as equivalent objects, VMM will select the instance of this equivalent object related to the VMM library which is assigned to host group where you deploy VM. Well, let’s see that!
First I will mark as equivalent objects my anwser files to show you how to make that. So I click on Library Servers, I select my two equivalent anwser files and I click on Mark Equivalent on top menu.
I fill the fields family and release and I click ok.
Now my anwser files located on my two VMM library are marked as equivalent objects.
Now I use my VHDX W2012R2DTC_v1.1.vhdx that are marked as equivalent in a VM Template. As you can see below, I select one VHDX belonging to equivalent object.
Just to remember you, currently the VMVMM01 library is assigned to Home host group and VMLIB01 is assigned to Work host group. So I deploy a VM from the above template on hypervisor of Home host group. So as you can see on below screenshot, the VHDX chosen by VMM is located on VMVMM01.
In case you do not believe me, I will reverse the assignation of VMM library servers to host groups. I can’t show you from a different way because I have only one Hyper-V host. So as you can see below, I assign VMLIB01 to Home host group and VMVMM01 to Work host group.
So I redeploy a VM from a template, and as below screenshot, I select Home host group to place VM.
And VMM select the VHDX located on VMLIB01 because this library is assigned to Home host group.
You believe me now? J
Microsoft doesn’t support VMM library that belong to a DFS namespace. That’s a shame because the other solution is Robocopy. To make that, you have to define a master server and slave servers. All modification make in library must be done from the master server and after that, launch a schedule task to robocopy change to slave servers. Below the robocopy command that I use:
Robocopy D:\VMMLibrary \\vmlib01\VMMLibrary /MIR /E /R:5 /W:30 /Log+:c:\temp\robocopy.log
- /MIR: mirror a directory tree. If something is added to the directory tree located on slave servers, these objects will be deleted;
- /E: copy subdirectories, including empty ones;
- /R: number of retries;
- /W: Wait X second between each retry;
- /Log+: log file in appending mode.