Check free space in c drive



Hi , I am new to UiPath
Can i check whether C drive is free or not ,using UiPath


Hey @prashanth_pachu


You have to import first System.IO namespace in your project.

DriveInfo drive_info = new DriveInfo(“C”);
Int64 Space_available= drive_info.AvailableFreeSpace;
Writeline((Space_available / (1024 * 1024*1024)).ToString) //will return available space in GB

Reference Sample: Drive space.xaml (5.6 KB)


How to check a C drive size
Calculate Size of a particular file

Thanks a lot,
it worked for me:slight_smile:


hi @aksh1yadav
Can i do the same for remote system?


hey @prashanth_pachu

Yes we can .
i am attaching one powershell script and use INvoke power shell activity with property IsScript to check. (429 Bytes)



Thanks for the idea.


hi @aksh1yadav
I tried this, due to restricrions ,i cant execute powershell script
i tried Set-ExecutionPolicy Unrestricted also
And remote system need Credentials also
Thanks & Regards


One more way (non scripting). You will still have permission restrictions, explore the options mentioned in comments.

RemoteSpace.xaml (17.2 KB)


hi @vvaidya
Thanks for the code but now i am not able to pass the password,it is showing an errror saying that option.Password is WriteOnly.
I used the same logic in c# console application , it worked, but not in UiPath


The Method above by Vinay uses WMI.
Windows Management Instrumentation (WMI) is a set of specifications from Microsoft for consolidating the management of devices and applications in a network from Windows computing systems.

Note: - Connection credentials to the remote computer, not needed if the logged account has access.

First Let me know your account has access then omit this password property and username property because

and if not then try the Invoke Code Activity and paste the code inside that :slight_smile:

        Dim options As New system.Management.ConnectionOptions()
        options.Username = "Aksh"
        options.Password = "testAkshay"

if you have already created an options object for ConnectionOptions then use that inargument in invoke code.



hi @aksh1yadav
thank you for your explaination, it worked for me :grinning:


Can we get these information using objectquery

Thanks & Regards


Hey @prashanth_pachu

Yeah we can even with Process thread and Performance counter classes also you can get the information but you want this also for remote server or a local system where you are running your script?



hi @aksh1yadav
i wanted it for remote server,
please let me know which approach to use.
Thanks & regards