vSphere 7 VM Template Versioning

This is a very useful feature with vSphere 7.Earlier version when we need to do modification or apply OS patches to template we need to convert template back to vm and had do that, but with vCenter 7 , we can maintain versioning.

How to do that?

1. First thing these templates should be in content library

1

2. I have created my template and its in my content library. If I click on template , we can see the version tab

2

3. Now I’m going to install Windows patches on this template, therefore I select the template and click on Check out VM From This Template on versioning tab. Then I have to give temporary name for this vm

Continue reading “vSphere 7 VM Template Versioning”

Identify VMDK sharing

Some times we may need to find out whether VMDK files are shared with some other vms. Using below script we an easily find that. We just need to give the vm name & it  will check for all the vmdk paths in all the VMS

 

connect-viserver vcentername

$vmname=read-host -Prompt “Enter the VM Name”

 

if (get-vm $vmname -erroraction SilentlyContinue)

{

$vdisk=get-vm $vmname |Get-VMHardDiskDrive

 

 

$allvms=get-vm

 

 

foreach ($allvm in $allvms)

{

if ($allvm.name -ne $vmname)

{

$vmdiskpath=get-vm $allvm |get-harddisk

foreach($disk in $vdisk)

{

if ($vmdiskpath.filename -eq $disk.filename)

{

$msg=”There is a VMDKS sharing with ”

$msg2=$allvm.name

$fullmsg=$msg+$msg2

Write-Host $fullmsg -ForegroundColor DarkGreen

}

}

}

 

}

}

else

{

Write-Host “VM is not available in the vCenter, please check the vm name”

}