Aegis ‘Depot’ Activity – Hyper-V Integration Part 4 - Creating and modifying CPU and startup Memory of Virtual Machines

Aegis ‘Depot’ Activity – Hyper-V Integration Part 4 - Creating and modifying CPU and startup Memory of Virtual Machines

Welcome to Part 4 of Hyper-V Integration Activities for NetIQ Aegis.   This is a 4 part cool tool Activity Library which will introduce and extend the functionality with new activities in each part bringing the power of Aegis Automation to Hyper-V environments.


In Part 1 (here) I provided Aegis Activities to Find, View Details and Modify the Power State of Hyper-V Virtual Machines.

Part 2 (here) focused on Virtual Machine Snapshots - taking / applying / listing and deleting snapshots.

Part 3 (here) focused on importing / exporting / renaming and deleting Virtual Machines.

Part 4 adds on activities to modifying Virtual Machine and CPU and creating a new Virtual Machine


Change CPU

The Change CPU activity changes the number of virtual processors for a virtual machine allowing you to automate a CPU hardware upgrade when the Virtual Machine is in a powered down state.

Like all the other Hyper-V activities discussed so far, each of these activities use common connection parameters with some extra configuration specific to the activity, in this case we just need to specify the unique instance ID of the Virtual Machine to modify and the new number of CPU's.



The actual number of CPUs you can specify is of course controlled by the Hyper-V server - the activity will allow you specify 1+ CPU's, but if you don't have 16 CPUs on the Hyper-V server it will still make the change.  The 16 CPUs will be visible also in the Hyper-V manager.  The configuration problem will only raise when you actually try and power on the virtual machine.



So this is another reason to always check the 'Result' output for success or failure.


Change Memory

The Change Memory activity changes the amount of  Memory for a Virtual Machine which corresponds to the 'Startup RAM' setting in HyperV Manager.  It does not alter dynamic memory settings in any way.  The configuration and the behavior of the activity is the same as the Change CPU activity in that the physical hardware needs to be present.


Just to note that the Memory value is give in MB!

Also to note, both Memory and CPU changes can only be made when the virtual machine is powered down or the activity will return an error generated on Hyper-V side - the error changing CPU indicates the reason but the error changing Memory is more generic - as usual you can use the Get VM details activity to verify the status of the Virtual Machine before making any changes to avoid failures.


Create VM

The Create VM activity creates a new virtual machine by specifying the Hyper-V connection details and a name for the new virtual machine.


The outputs of the activity are the normal success / fail plus error message and it also includes the unique instance ID for the newly created virtual machine so that you can perform operations on it like modifying the amount of CPU and Memory.  It is possible to create any number of virtual machines with the same name, it is the instance ID output which uniquely identifies each Virtual Machine.  To remove duplicates the 'Find VM' activity can be used to find all machines matching a specific

Adding this activity is like adding a pandora's box - as where do you end with the configuration?  Originally I had planned on adding Network Cards, Disks etc. but with so many configuration options it was  little big for this demo!  Perhaps in Part 5 of 4 🙂  By itself though you really only get to pre-create a new Virtual Machine without an OS based on the default VM settings.  Probably a better idea is to import a 'vanilla build' OS Virtual Machine image as a template (see part 3), modify the CPU and Memory requirements and away you go!


Hyper-V Activities Top Tip #4

Changes made to the number of CPUs and amount of Memory may have a negative impact on the Operating System running on the Virtual Machine , it may break the OS license or the OS may not be able to support or detect the new specified quantities.  This is outside the control of the activities and behavior is the same as if changes were made in the Hyper-V Manager.


 Hyper-V Activity Use Cases:

These activities bring the ability to automate more tasks in Hyper-V for example:

1. Modify Virtual Machine CPU + Memory settings to a minimum value before exporting from Hyper-V server A to server B to ensure hardware resources are available.

2. Perform automated stress test cases on Infrastructure based on modifying CPU and Memory.

3. Use a Find VM activity to find any imported or configured Virtual Machines which have higher values for CPU and / or Memory than permitted and change them immediately or schedule to change when next powered off.


I started off the series by saying that using specific Aegis activities rather than scripting would lead to a much easier experience for the workflow developer who doesn't have to worry about parsing script outputs as all the outputs are directly available.  On the other hand you'll see you have to enter the connection information into each activity (although this is done dynamically using variables rather than hard-coded as in my screenshots) it is still a tedious operation that you might like to avoid.  The next layer of integration above this would be to use an adapter which would simplify the activities further so instead of providing all credentials each time, you just provide an alias or locator to the Hyper-V server and authentication is handled automatically.  An adapter would also allow resources to be automatically discovered and loaded into IQRM, poll for events from Hyper-V, a browse able namespace etc.   Choosing an adapter might be the point where you change your integration point to Microsoft System Center rather than individual Hyper V servers - adapters do take a lot longer to develop than individual activities so there is a trade off.


So there you go!  I hope you found this a useful introduction to the possibilities of Hyper-V Management via Aegis!


Activity Installation Instructions are here:
Labels (1)


Some content on Community Tips & Information pages is not officially supported by Micro Focus. Please refer to our Terms of Use for more detail.
Top Contributors
Version history
Revision #:
10 of 10
Last update:
‎2020-01-09 16:44
Updated by:
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.