Because I already tried to answer, I will try again.
I tested and the following code should work:
using System.Management;
private static string GetAdminPath(string computerName)
{
if (computerName == null || computerName.Length == 0) computerName =
Environment.MachineName;
ManagementClass c = new
ManagementClass(String.Format(@"\\{0}\root\cimv2:W in32_Share",
computerName));
foreach (ManagementObject o in c.GetInstances())
{
if ((string) o["Name"] == "ADMIN$") return (string) o["Path"];
}
return null;
}
Note that it is likely that the running user must have admin right on
that machine, just as when you check this with Control Panel's Computer
Management.
Thi
http://thith.blogspot.com