This posting is provided "AS IS" with no warranties, and confers no rights
Hi,
I found the following code hope it helps , site link is at the bottom :
================================================
.NET Framework Class Library :
ConnectionOptions Class
================================================
[C#]
-----------------------------START
CODE---------------------------------------------------------
public class ConnectionOptions : ManagementOptions
using System;
using System.Management;
// This example demonstrates how to connect to remote machine
// using supplied credentials.
class Sample_ConnectionOptions
{
public static int Main(string[] args) {
ConnectionOptions options = new ConnectionOptions();
options.Username = UserName; //could be in domain\user format
options.Password = SecurelyStoredPassword;
ManagementScope scope = new ManagementScope(
"\\\\servername\\root\\cimv2",
options);
try {
scope.Connect();
ManagementObject disk = new ManagementObject(
scope,
new ManagementPath("Win32_logicaldisk='c:'"),
null);
disk.Get();
}
catch (Exception e) {
Console.WriteLine("Failed to connect: " + e.Message);
}
return 0;
}
}
-------------------------- END CODE
--------------------------------------------------------------
URL :
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/
frlrfsystemmanagementconnectionoptionsclasstopic.asp
Regards,
Venkat.