How to get remote computer diskdrive info.

i have already done for  in my system drive info but now i want get remote  computer drive info
Vishal GundageAsked:
Who is Participating?
 
Hello ThereConnect With a Mentor System AdministratorCommented:
If you use CMD for getting information, use PsEXEC:
1. Instal PsEXEC on your computer
2. Run CMD as Administrator
3. C:\Users\you>psexec \\192.168.0.100 -u domainname\adminname -p adminpassword cmd
PsExec v2.2 - Execute processes remotely
Copyright (C) 2001-2016 Mark Russinovich
Sysinternals - www.sysinternals.com
C:\Windows\system32>type your commands here

OR

1. Install Free Windows Admin Tool on your computer
2. Set it up for your domain and choose all devices you'd like to know some info about, including disk info and more
0
 
Shaun VermaakConnect With a Mentor Technical Specialist/DeveloperCommented:
Use the System.Management namespace
ManagementPath path = new ManagementPath() {
    NamespacePath = @"root\cimv2",
    Server = "<REMOTE HOST OR IP>"
};
ManagementScope scope = new ManagementScope(path);
string condition = "DriveLetter = 'C:'";
string[] selectedProperties = new string[] { "FreeSpace" };
SelectQuery query = new SelectQuery("Win32_Volume", condition, selectedProperties);

using (ManagementObjectSearcher searcher = new ManagementObjectSearcher(scope, query))
using (ManagementObjectCollection results = searcher.Get())
{
    ManagementObject volume = results.Cast<ManagementObject>().SingleOrDefault();

    if (volume != null)
    {
        ulong freeSpace = (ulong) volume.GetPropertyValue("FreeSpace");

        // Use freeSpace here...
    }
}

Open in new window

https://stackoverflow.com/questions/14442960/getting-drive-info-from-a-remote-computer
0
 
Hello ThereSystem AdministratorCommented:
Required information provided.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.