While there is an official VMware vSphere Integration Pack for Orchestrator available from Microsoft (here) I was working for a customer the other week where they had an extra need that the Create Snapshot activity didn’t seem to provide.
The customer as part of their SoP (Standard Operating Proceedure) have the requirement that all snapshots are quiesced for both memory and file operations during a snapshot activity.
While the vSphere IP activity allows you to set the option for capturing the memory state with the snapshot, there is no reference as to whether it quiesces the file system by default or not.
So the quickest way to achieve this, fall back to PowerShell and script it.
VMware have a PowerShell module available for vSphere known as PowerCLI.
Once I had downloaded and installed this on both the Runbook Designer workstations and the SCORCH server I started working on the script.
The script:
$VC = "<Insert vCenter Server>"
$VMName = "<Insert VM Name>"
$Snapshot = "<Insert VM Name>"
if(-not (Get-PSSnapin VMware.VimAutomation.Core -ErrorAction SilentlyContinue))
{
Add-PSSnapin VMware.VimAutomation.Core
}
Set-PowerCLIConfiguration -DefaultVIServerMode Single -InvalidCertificateAction Ignore -confirm:$false
Connect-VIServer -Server $VC -ErrorAction SilentlyContinue
Get-VM $VMName | New-Snapshot -Name $Snapshot -Memory:$true -Quiesce:$true -Description "Snapshot for protection while running automated process" -Confirm:$false
Basically this script will take the input of a virtual machine name and a name for the snapshot then perform a snapshot of the VM but with the options set to quiesce both the memory and file system.
Showing posts with label VMware. Show all posts
Showing posts with label VMware. Show all posts
Wednesday, 3 April 2013
Orchestrator & VMware vSphere – Calculate Datastore Capacity
While there is an official VMware vSphere Integration Pack for Orchestrator available from Microsoft (here) I was working for a customer the other week where I ran into a problem that meant we couldn’t use it and I had to work around it.
The problem looks to stem from having a vApp present within their vSphere environment, as discussed in this TechNet forum thread: http://social.technet.microsoft.com/Forums/en-US/scoscip/thread/2a1c03db-c24b-43c8-b035-f7c8cd6f6a83/
The biggest problem we had is that the Get Datastore Capacity activity which was failing was the very first step of the process that we were trying to automate.
The customer wanted to be able to check that there was sufficient space as dictated by their SoP (Standard Operating Proceedure) on the Datastore before taking snapshots of the VM’s.
So the quickest way to achieve this, fall back to PowerShell and script it.
So the quickest way to achieve this, fall back to PowerShell and script it.
VMware have a PowerShell module available for vSphere known as PowerCLI.
Once I had downloaded and installed this on both the Runbook Designer workstations and the SCORCH server I started working on the script.
N.B. There is also a community IP from Ryan Andorfer that wraps the PowerCLI into activities, but it's based on PowerCLI v4 and isn't compatible with PowerCLI v5 which is what I wanted to utilise.
Once I had downloaded and installed this on both the Runbook Designer workstations and the SCORCH server I started working on the script.
This is a modified version of the script that LucD discusses on the VMware community forums here: http://communities.vmware.com/message/2119043
The script:
$VC = "<Enter vCenter name here>"
if(-not (Get-PSSnapin VMware.VimAutomation.Core -ErrorAction SilentlyContinue))
{ Add-PSSnapin VMware.VimAutomation.Core
}
Set-PowerCLIConfiguration -DefaultVIServerMode Single -InvalidCertificateAction Ignore -confirm:$false
Connect-VIServer -Server $VC -ErrorAction SilentlyContinue
$VMInfo=Get-VM "<Enter VM Name here>" | Select Name, MemoryGB, UsedSpaceGB, @{N="Cluster";E={Get-Cluster -VM $_}}, @{N="ESX Host";E={Get-VMHost -VM $_}}, @{N="Datastore";E={Get-Datastore -VM $_}}
$ESXiHost=$VMInfo.ESXHost.name
$DSName=$VMInfo.datastore.name
$VMMem=$VMInfo.MemoryGB
$VMHD=$VMInfo.UsedSpaceGB
$Datastore=Get-Datastore -Name $DSName | select Name, @{N="Capacity";E={[Math]::Round($_.CapacityMB/1024,2)}}, @{N="FreeSpace";E={[Math]::Round($_.FreeSpaceMB/1024,2)}}
$Capacity=$Datastore.Capacity
$FreeSpace=$Datastore.FreeSpace
*Sorry about the formatting, blogger mangles code*
Basically this script will take the input of a virtual machine name, lookup which datastore the VM resides on and then query that datastore for the available free space and output it as a variable that we capture onto the SCORCH databus.
$VC = "<Enter vCenter name here>"
if(-not (Get-PSSnapin VMware.VimAutomation.Core -ErrorAction SilentlyContinue))
{ Add-PSSnapin VMware.VimAutomation.Core
}
Set-PowerCLIConfiguration -DefaultVIServerMode Single -InvalidCertificateAction Ignore -confirm:$false
Connect-VIServer -Server $VC -ErrorAction SilentlyContinue
$VMInfo=Get-VM "<Enter VM Name here>" | Select Name, MemoryGB, UsedSpaceGB, @{N="Cluster";E={Get-Cluster -VM $_}}, @{N="ESX Host";E={Get-VMHost -VM $_}}, @{N="Datastore";E={Get-Datastore -VM $_}}
$ESXiHost=$VMInfo.ESXHost.name
$DSName=$VMInfo.datastore.name
$VMMem=$VMInfo.MemoryGB
$VMHD=$VMInfo.UsedSpaceGB
$Datastore=Get-Datastore -Name $DSName | select Name, @{N="Capacity";E={[Math]::Round($_.CapacityMB/1024,2)}}, @{N="FreeSpace";E={[Math]::Round($_.FreeSpaceMB/1024,2)}}
$Capacity=$Datastore.Capacity
$FreeSpace=$Datastore.FreeSpace
*Sorry about the formatting, blogger mangles code*
Basically this script will take the input of a virtual machine name, lookup which datastore the VM resides on and then query that datastore for the available free space and output it as a variable that we capture onto the SCORCH databus.
While I was writing the script and finding the datastore for the VM I thought we might as well pull back some other info regarding the VM and ESX host so the script also makes some more information available as variables that we can push back onto the databus.
Variables:
Datastore Name ($Datastore)
Datastore Capacity ($Capacity)
Datastore FreeSpace ($FreeSpace)
VM Assigned Memory ($VMMem)
VM Assigned Disk Size ($VMHD)
ESX Host running the VM ($ESXiHost)
Datastore Capacity ($Capacity)
Datastore FreeSpace ($FreeSpace)
VM Assigned Memory ($VMMem)
VM Assigned Disk Size ($VMHD)
ESX Host running the VM ($ESXiHost)
Add this into a simple runbook as shown below and we can prompt for a virtual machine name (or pass it across from a calling runbook!), query vSphere for all the details and then return the data to be used as part of the further process.
Labels:
ESX,
Orchestrator,
SCO,
SCORCH,
System Center,
VMware,
vSphere
Thursday, 15 November 2012
Extended Virtual Machine Discovery Management Pack
Infront released a new management pack, a while ago, for FREE, to the community via System Center Central.
http://www.systemcentercentral.com/tabid/143/indexid/94055/default.aspx?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+systemcentercentral%2Fblogs+%28Blogs+at+System+Center+Central%29
This management pack will give you a deeper insight into your virtual machines including recognising which platform (Hyper-V, VMware & Citrix), which hosts they're located on, if VM Tools are installed and the version.
(footnote. I actually wrote this post the day they released it, but forgot to post it /facepalm)
http://www.systemcentercentral.com/tabid/143/indexid/94055/default.aspx?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+systemcentercentral%2Fblogs+%28Blogs+at+System+Center+Central%29
This management pack will give you a deeper insight into your virtual machines including recognising which platform (Hyper-V, VMware & Citrix), which hosts they're located on, if VM Tools are installed and the version.
(footnote. I actually wrote this post the day they released it, but forgot to post it /facepalm)
Tuesday, 19 June 2012
Configuration Manager 2012 and VMware vCenter Protect Update Catalog
My colleague spent some time in the TrustLab today installing VMware vCenter Protect Update Catalog. This was previously a solution from Shavlik and provides update management of third party applications such as Adobe Reader, QuickTime, Sun Java etc directly from within System Center 2007/2012 Configuration Manager alongside the normal Microsoft patch updates.
You can find Part 1 of his blog post on the installation here: http://ixrv.blogspot.co.uk/2012/06/configuring-scup-2011-shavlikvmware.html
More info on vCenter Protect Update Catalog (They need a better name!) can be found here:
http://www.vmware.com/products/datacenter-virtualization/vcenter-protect-update-catalog/overview.html
You can find Part 1 of his blog post on the installation here: http://ixrv.blogspot.co.uk/2012/06/configuring-scup-2011-shavlikvmware.html
More info on vCenter Protect Update Catalog (They need a better name!) can be found here:
http://www.vmware.com/products/datacenter-virtualization/vcenter-protect-update-catalog/overview.html
Subscribe to:
Posts (Atom)