cancel
Showing results for 
Search instead for 
Did you mean: 

System Information

MadhuGarg
Level 4
Hi All,

Is there any option to obtain System Information (Space available in drives, Machine name) using Blue Prism ?
Thanks in advance.

------------------------------
Madhu Garg
------------------------------
6 REPLIES 6

expertcr
Staff
Staff
We do not have a VBO for this, but you can run a batch file to get this info using the command systeminfo

23843.png


------------------------------
Luis Lopez
Customer Support Engineer English and Spanish
Blue Prism Ltd
------------------------------

Hi @MadhuGarg,

@Luis Lopez has suggested a great way to retrieve all system information using command line command. I can also suggest you a custom VBO which you can build in order to get Machine Name, Total Memory and Memory for individual drives using code stage.

You can create a new business object named 'Utility - System' and add an action called 'Get System Information'​ with a code stage added in the workflow and three data items as shown below:

23844.png
Here, we have two data items and a collection. Also have these data items mapped to the output arguments in your 'End' stage:

Available Memory (Text) - Gives me the total available virtual memory in the system.
Machine Name (Text) - Gives me the host name of the machine being used.
Drive Status (Collection) - Gives me the size for each of the drives being used.

Now, in the code stage add the following output parameters and code:

23845.png
23846.png

Code: 

' Initialize Variables
Dim DriveStatusTable As DataTable
Dim DriveStatusRow As DataRow
Dim driveInfo As System.IO.DriveInfo

' Initialize Drive Status Table
DriveStatusTable = New DataTable()

' Add Data Columns To Drive Status Table
DriveStatusTable.Columns.Add("Drive Name",GetType(String))
DriveStatusTable.Columns.Add("Drive Total Size (in bytes)",GetType(Decimal))
DriveStatusTable.Columns.Add("Drive Available Free Size (in bytes)",GetType(Decimal))

Dim drives As String() = System.IO.Directory.GetLogicalDrives()

For Each driveName As String In drives


	' Initialize New Data Row For Drive Status Table
	DriveStatusRow = DriveStatusTable.NewRow()

	'Get Drive Details
	driveInfo = New System.IO.DriveInfo(driveName.ToString())
	DriveStatusRow("Drive Name") = driveName.ToString()
	DriveStatusRow("Drive Total Size (in bytes)") = CDbl(driveInfo.TotalSize)
	DriveStatusRow("Drive Available Free Size (in bytes)") = CDbl(driveInfo.AvailableFreeSpace)

	' Add Data Row To Drive Status Table
	DriveStatusTable.Rows.Add(DriveStatusRow)



Next

'Assign Output Arguments

Drive_Status = DriveStatusTable
Available_Memory = My.Computer.Info.AvailableVirtualMemory
Machine_Name = Environment.MachineName​


Test Results:

23847.png

Let me know if that helps you out!

------------------------------
----------------------------------
Hope it helps you out and if my solution resolves your query, then please mark it as the 'Best Answer' so that the others members in the community having similar problem statement can track the answer easily in future

Regards,
Devneet Mohanty
Intelligent Process Automation Consultant | Sr. Consultant - Automation Developer,
WonderBotz India Pvt. Ltd.
Blue Prism Community MVP | Blue Prism 7x Certified Professional
Website: https://devneet.github.io/
Email: devneetmohanty07@gmail.com

----------------------------------
------------------------------
---------------------------------------------------------------------------------------------------------------------------------------
Hope this helps you out and if so, please mark the current thread as the 'Answer', so others can refer to the same for reference in future.
Regards,
Devneet Mohanty,
SS&C Blueprism Community MVP 2024,
Automation Architect,
Wonderbotz India Pvt. Ltd.

Thanks @devneetmohanty07 for detailed explanation. I will definitely follow this & update you.​

------------------------------
Madhu Garg
------------------------------

Hi Devneet Mohanty,  when i tried to run the code stage it throws the following error :

Internal : Could not execute code stage because exception thrown by code stage: The device is not ready.

Could you give a reply asap. I need solution for this asap, Thanks 



------------------------------
DILIPKUMAR S
------------------------------

Hi @DILIPKUMAR S ,

You can modify the code a bit which I have provided earlier:

' Initialize Variables
Dim DriveStatusTable As DataTable
Dim DriveStatusRow As DataRow
Dim driveInfo As System.IO.DriveInfo

' Initialize Drive Status Table
DriveStatusTable = New DataTable()

' Add Data Columns To Drive Status Table
DriveStatusTable.Columns.Add("Drive Name",GetType(String))
DriveStatusTable.Columns.Add("Drive Total Size (in bytes)",GetType(Decimal))
DriveStatusTable.Columns.Add("Drive Available Free Size (in bytes)",GetType(Decimal))

Dim drives As String() = System.IO.Directory.GetLogicalDrives()

For Each driveName As String In drives


	' Initialize New Data Row For Drive Status Table
	DriveStatusRow = DriveStatusTable.NewRow()

	'Get Drive Details
	driveInfo = New System.IO.DriveInfo(driveName.ToString())

        If driveInfo.IsReady = True Then

	      DriveStatusRow("Drive Name") = driveName.ToString()
	      DriveStatusRow("Drive Total Size (in bytes)") = CDbl(driveInfo.TotalSize)
	      DriveStatusRow("Drive Available Free Size (in bytes)") = CDbl(driveInfo.AvailableFreeSpace)

	      ' Add Data Row To Drive Status Table
	      DriveStatusTable.Rows.Add(DriveStatusRow)

       End If



Next

'Assign Output Arguments

Drive_Status = DriveStatusTable
Available_Memory = My.Computer.Info.AvailableVirtualMemory
Machine_Name = Environment.MachineName​


In the above code, I have added a condition: If driveInfo.IsReady = True Then ...... End If

This will check if the device is ready or not at that time. If yes then only it will execute the inner block statements.



------------------------------
----------------------------------
Hope it helps you out and if my solution resolves your query, then please mark it as the 'Best Answer' so that the others members in the community having similar problem statement can track the answer easily in future

Regards,
Devneet Mohanty
Intelligent Process Automation Consultant | Sr. Consultant - Automation Developer,
WonderBotz India Pvt. Ltd.
Blue Prism Community MVP | Blue Prism 7x Certified Professional
Website: https://devneet.github.io/
Email: devneetmohanty07@gmail.com

----------------------------------
------------------------------
---------------------------------------------------------------------------------------------------------------------------------------
Hope this helps you out and if so, please mark the current thread as the 'Answer', so others can refer to the same for reference in future.
Regards,
Devneet Mohanty,
SS&C Blueprism Community MVP 2024,
Automation Architect,
Wonderbotz India Pvt. Ltd.

FWIW - There is now a VBO on the Digital Exchange for collecting system information. See the asset page at the following link:

https://digitalexchange.blueprism.com/dx/entry/3439/solution/blue-prism---utility---systeminfo

Cheers,



------------------------------
Eric Wilson
Director, Integrations and Enablement
Blue Prism Digital Exchange
------------------------------