Get physical and virtual memory information UiPath

While designing the business process automation let’s say you want to verify the physical or virtual memory information of that machine.

If the available physical memory matches a certain value the bot needs to process further else it needs to be terminated.

What is physical memory?

Random access memory (RAM) is physical memory that holds the applications, documents, and procedures on a computer.

What is virtual memory?

Virtual memory is a storage area that holds the files on your hard drive for retrieval when a computer runs out of RAM.

Now you got some information about physical and virtual memory.

Let’s get into the practical implementation of this task:

Step1: The Memory utilization values that we are evaluating in this article are shown in the task manager.

The below screenshot shows you how it looks like:

task manager memory

This memory utilization varies from time to time, So please check the value in the task manager before executing the workflow.

Step2: Drag and Drop assign activity from actions panel to designer panel and enter the code as shown below:

computer info variable

Here:

The variable computerinfo is of type Microsoft.VisualBasic.Devices.ComputerInfo.

Total Physical Memory:

Step3: Drag and Drop an assign activity from the activities panel to the designer panel and enter the code as shown below:

get physical and virtual memory information

Here totalPhysicalMemory variable holds the total physical memory value and the variable type is double.

The output of total physical memory is shown below:

Total Virtual Memory:

Step4: Drag and Drop an assign activity from the activities panel to the designer panel and enter the code as shown below:

get physical and virtual memory information

Here totalVirtualMemory variable holds the total virtual memory value and the variable type is double.

The output of total physical memory is shown below:

Available Physical Memory:

Step5: Drag and Drop an assign activity from the activities panel to the designer panel and enter the code as shown below:

get physical and virtual memory information

Here availablePhysicalMemory variable holds the available physical memory value and the variable type is double.

The output of total physical memory is shown below:

Available Virtual Memory:

Step6: Drag and Drop an assign activity from the activities panel to the designer panel and enter the code as shown below:

get physical and virtual memory information

Here availableVirtualMemory variable holds the available virtual memory value and the variable type is double.

The output of total physical memory is shown below:

Note: The value that you will get from the above-mentioned commands is in the form of KB.

To convert that to GB divide the output value with 1024*1024*1024.

Happy Learning!

Like this post then let your friends know about this-:

Leave a Reply

Your email address will not be published. Required fields are marked *