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:

23 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

I am using unable to connect to a local hyper-v server and get a list of VMs. I have tried various combanations with credentials. It is my understanding leaving server,username and password should connect to local Hyper-V server. I have two VM on a windows 10 machine, not joined to a domain.

@Tomlin it works (see screenshot below), but Authenticated Users must be a member of local Hyper-V Administrators group (might require restart)

Hi @ovidiuponoran , I think this is a great activities, and since last week I’ve started evaluating the activities I want to use for each single feature.There are two things I want to confirm about the Get VM List activity.

1.Environmental specifications

Item Value
Studio Community Edition 23.4.0
OS Windows 10 Pro
Hyper-V Activities v1.2.0

2.Confirmation One

1)Issue

If the OS language setting is other than English, VM List objects of output will be nothing.

2)Test Results

From the test results, all languages other than English seem to be Nothing.on the other hand, Get VM by ID activitiy works fine in any language.

OS Language Get VM List Get VM by ID
English OK OK
French Nothing OK
Japanese Nothing OK

3.Confirmation Two

1)Issue or specification?

Is it a specification that the object value is empty when the OS language setting is English?

2)Test Results

This is a confirmation of the design concept. Get the minimum number of items in the Get VM List activity, and if you want to get more items, use the Get VM by ID activity to check?

Item Value Result
Name OK
Id OK
GuestOS Nothing
Generation OK
RAM Nothing
State OK

For the time being, I will change the language setting of the OS to English and try using it, but although it is issue one, if it can be easily fixed, I would be happy if it was fixed in the next release.


Debug when OS Language is English
OK-fig1
OK-fig2

Debug when OS Language is French or Japanese
Nothing-fig1

Best Regards.