Microsoft Hyper-V Activities are now in Public Preview

:loudspeaker: Microsoft Hyper-V Activities are now in Public Preview

Description

UiPath.HyperV.Activities package offers activities for Microsoft Hyper-V virtualized infrastructure.

This set of activities enables IT Departments to easily automate processes related to the provisioning, management and maintenance of Hyper-V virtual machines. Here are some of the automation that can be created using this package:

  • Provision a new server from a template (e.g. for a new application deployment).
  • Take a checkpoint of a virtual machine before installing an update package or a newer version of a program.
  • Reset, start/turn off virtual machines (e.g. for applications and OS updates, resource efficiency).

Activities List

Server Virtualization \ HyperV

HyperV Scope - Connects to a Hyper-V Host and provides a scope for other Hyper-V activities.

Server Virtualization \ HyperV \ Virtual Machines

Create VM From Template - Provisions a new virtual machine from a template.
Get VM by ID - Retrieves the details of the specified virtual machine.
Get VM List - Retrieves a list of virtual machines.
Start VM - Starts a virtual machine.
Turn Off VM - Turns off a virtual machine.
Shutdown VM - Shuts down the Operating System of the specified virtual machine.
Pause VM - Pauses a virtual machine.
Resume VM - Resumes a virtual machine.
Reset VM - Resets a virtual machine.
Rename VM - Renames a virtual machine.
Delete VM - Deletes a virtual machine.
Import VM - Imports a virtual machine.
Export VM - Exports a virtual machine.
Configure Robot - Connects the Robot in a given VM to Orchestrator.

Server Virtualization \ HyperV \ Virtual Machines \ Checkpoints

Take VM Checkpoint - Takes a checkpoint of the specified virtual machine.
Get VM Checkpoint List - Retrieves all checkpoints of the specified virtual machine.
Delete VM Checkpoint - Deletes a given checkpoint of the specified virtual machine.
Delete All VM Checkpoints - Deletes all checkpoints of the specified virtual machine.
Revert VM to Checkpoint - Reverts the virtual machine to a specified checkpoint. If no checkpoint exists, the activity does nothing and the virtual machine state remains unchanged.

How to install

UiPath.HyperV.Activities package is available in the Official feed, as a prerelease. In the Official feed, check ‘Include Prerelease’, search for “UiPath.HyperV.Activities”, and install the latest version.
** Important - We must reiterate, make sure you check the ‘Include Prerelease’ checkbox :blush:

Hyper-V activities should be visible now in UiPath Studio, as shown below:

How to use

The following sample workflows demonstrate how to use Hyper-V activities in practice.

Virtual machines management

This UiPath process contains two workflows exemplifying how to provision new virtual machines and how to power off those which are not needed to be running 24/7.

  • CreateVirtualMachines : creates two virtual machines based on a template (virtual hard disk file). One of them must be running 24/7 (VM’s description contains the text “[AlwaysOn]=True”) and the other can be turned off at night (VM’s description contains the text “[AlwaysOn]=False”)
  • TurnOffVirtualMachines : turns off all running virtual machines containing “[AlwaysOn]=False” in their description.

HyperV_VMManagement.zip (15.0 KB)

Take checkpoints of build virtual machines

In this scenario, we have a set of build machines running automated scripts for building and distributing software applications to the testers. Installing Windows updates or a newer version of a piece of software can affect the build process. For this reason, it is highly recommended to take a checkpoint of such VM before applying any updates. If something goes wrong after the update, the VM can be reverted to a previous checkpoint.

This UiPath process takes checkpoints of all build machines available in a Hyper-V Host. First, it retrieves all virtual machines acting as build machines (VM’s name starts with “build-“). Then it takes a checkpoint of each VM in this list. Finally, it creates a .csv file report containing details about the newly created checkpoints.

HyperV_Checkpoints.zip (11.7 KB)

To exemplify, let’s go step by step through the process of creating this workflow:

  1. Let’s add first a HyperV Scope activity and provide a value for HyperVHost input parameter like in the screenshot below. Because Username and Password are not set, the credentials of the current logged in user will be used to connect to the Hyper-V virtualization server.

  2. Let’s continue by adding a Get VM List activity to retrieve all build VMs, i.e. their names start with “build-”. The list of VMs matching the filter criteria is stored in buildMachines variable. The parameters used to specify the filter are:

    • FilterBy (Enum) - The property to filter by. In our case: “Name”.
    • FilterOperator (Enum) - The operator to be used in the filter expression. In our case: “StartsWith”.
    • FilterValue (String) - The value for the property to filter by. In our case: “build-“.

  3. For each VM in buildMachines list, let’s take a checkpoint using Take VM Checkpoint activity. In addition, we store the information about each checkpoint in checkpointInfo variable using Add Data Row activity. The parameters of the Take VM Checkpoint activity are:

    • VirtualMachine (VirtualMachine) - The virtual machine on which the operation will be performed.
    • CheckpointName (String) - The name of the checkpoint to be created.
    • CheckpointDescription (String) - The description of the checkpoint.

  4. Finally, let’s use Write CSV activity to save the value of checkpointInfo variable to a .csv file. The resulted file looks like the one shown below. That’s all folks! Enjoy :blush:

20 Likes

Looks very useful indeed. Game changing updates to UiPath of late, this is certainly in that category outside looking in

5 Likes

Cool, for IT operations and provisoning servers. Different angle than your typical backoffice tasks.

3 Likes