18-10-22 06:12 PM
18-10-22 10:47 PM
19-10-22 12:01 AM
' 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
19-10-22 07:48 AM
27-04-23 08:28 AM
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
27-04-23 09:15 AM
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.
27-04-23 07:57 PM
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,