Salta al contenuto principale

Pre-post data capture commands - pass machine name to script

Thread solved

Hi,

 

is it possible to pass known valiables to a pre-post command?

We have some VMware-VMs which must be shutdown prior data capture begins and would be nice to start them again afterwards.

One packup plan ist setup for a VM-Folder, all machines should be shutdown before data capture to minimize downtime.

Vasily provided an example script here some time ago but it would work for a manually given machine name only.

Since members of that VM-Folder are varying the backup plan (or script in this case) shouldn't be altered manually every time.

 

There are variables used in "backup file name" setting, it would be nice to have them passed to any script in pre-post commands.

 

Best regards,

Raphael

0 Users found this helpful
frestogaslorastaswastavewroviwroclolacorashibushurutraciwrubrishabenichikucrijorejenufrilomuwrigaslowrikejawrachosleratiswurelaseriprouobrunoviswosuthitribrepakotritopislivadrauibretisetewrapenuwrapi
Messaggi: 22
Commenti: 3800

Hi Raphael,

Currently there is one way to pass the runtime value (context) of a backup plan into the pre/post commands. The value which can be passed corresponds VM "InstanceUUID" property of a VM which is set in vSphere (by vCenter/ESXi host) and this property is used to uniquely identify VM in Acronis Backup. This property can be seen when viewing VM details->All Properties -> look for "ID" value:

This ID can be used as varilable in pre/post commands by referring to "{RESOURCE_ID}" property. In my below example it's used as parameter for batch file which saves the output of the arguments into text file.

IMPORTANT: this variable can be used ONLY in "Pre-post data capture commands" (won't work in regular "Pre-post commands") - these are the commands executed once for each VM included into the backup plan - pre-command runs before initiating VMware snapshot and the post-command is executed after snapshot is created, so it fully aligns with your scenario.

Here's what was generated in the outputs:

So in your case you can pass the ID to PowerShell command responsible for powering on/Off the VMs and the currently processed VM will be defined by this ID (which is the real "InstanceUUID" property in vSphere, so it can also be used for automating the process.

An example on how to retrieve vCenter Instance UUID property of a VM via PowerCLI can be found here: https://communities.vmware.com/docs/DOC-18513

Thank you.

Hi Vasily,

thanks for your suggestion and explanation, it worked so far.

First I got confused about the UUID and I don't have a vCloud Director running.

Here is how to get the "right" InstanceUUID directly from vCenter via PowerShell:

Get-VM | %{$_.extensiondata.config.InstanceUUID}

 

Thanks a lot!

Best regards,

Raphael

frestogaslorastaswastavewroviwroclolacorashibushurutraciwrubrishabenichikucrijorejenufrilomuwrigaslowrikejawrachosleratiswurelaseriprouobrunoviswosuthitribrepakotritopislivadrauibretisetewrapenuwrapi
Messaggi: 0
Commenti: 2016

Hello Raphael,

thanks for sharing the result and the details on this forum!