Click here to Skip to main content
15,913,610 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
hi all

how can i get the partition drive size on remote desktop using simple c# code ?


please help :)
Posted
Comments
Did you try anything?
sam9787 31-Aug-14 2:01am    
hi
i try this code for local host

DriveInfoSystem info = DriveInfo.GetInfo(@"\\10.10.10.10\C:");
lngFreeSpace = Convert.ToDouble(info.Available);
lngTotalSpace = Convert.ToDouble(info.Total);
lngFreeSpace = ((lngFreeSpace / 1024) / 1024) / 1024;
lngTotalSpace = ((lngTotalSpace / 1024) / 1024) / 1024;
Mehdi Gholam 31-Aug-14 1:56am    
You can't get that information via remote desktop unless you run the code on that machine.
What is the issue with this code?
sam9787 31-Aug-14 2:12am    
sorry
this is the correct code for local host



DriveInfoSystem info = DriveInfo.GetInfo("C:\");
lngFreeSpace = Convert.ToDouble(info.Available);
lngTotalSpace = Convert.ToDouble(info.Total);
lngFreeSpace = ((lngFreeSpace / 1024) / 1024) / 1024;
lngTotalSpace = ((lngTotalSpace / 1024) / 1024) / 1024;

1 solution

See http://stackoverflow.com/a/14443854/2282485[^] for an example of how to do it using WMI.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900