D
DBC User
I have a program in the network location, which when running, it needs
to find out what are all the drives available in the PC. I have the
following code in my program
using (ManagementClass netwConn = new
ManagementClass("Win32_NetworkConnection"))
{
ManagementObjectCollection shares =
netwConn.GetInstances();
foreach (ManagementObject share in shares)
{
Console.WriteLine("{0} - {1}", share["LocalName"],
share["RemotePath"]);
if (path.Equals(share["RemotePath"].ToString()))
return share["LocalName"].ToString();
}
return "";
}
I realised that since the application is invoked from the server, it
might be trying to find the drives in the server insteaded of my PC.
Is this a correct if so, how can I identify all the drives available
in the PC itself instead of Server?
to find out what are all the drives available in the PC. I have the
following code in my program
using (ManagementClass netwConn = new
ManagementClass("Win32_NetworkConnection"))
{
ManagementObjectCollection shares =
netwConn.GetInstances();
foreach (ManagementObject share in shares)
{
Console.WriteLine("{0} - {1}", share["LocalName"],
share["RemotePath"]);
if (path.Equals(share["RemotePath"].ToString()))
return share["LocalName"].ToString();
}
return "";
}
I realised that since the application is invoked from the server, it
might be trying to find the drives in the server insteaded of my PC.
Is this a correct if so, how can I identify all the drives available
in the PC itself instead of Server?