سلام 😉 در این مطلب از وب سایت پروگرم 98 آموزش اتصال به یک remote computer و نمایش اطلاعات سیستم عامل در سی شارپ را آماده کردم. انشاالله که این کد سی شارپ براتون مفید باشد.
کد اتصال به یک remote computer و نمایش اطلاعات سیستم عامل در سی شارپ :
using System;
using System.Management;
using System.Security;
public class RemoteConnect
{
public static void Main()
{
SecureString pw = new SecureString();
pw.AppendChar('a');
pw.MakeReadOnly();
ConnectionOptions options = new ConnectionOptions("MS_409", "userName", pw,"ntdlmdomain:DOMAIN",
System.Management.ImpersonationLevel.Impersonate,
System.Management.AuthenticationLevel.Default, true,
null, System.TimeSpan.MaxValue);
pw.Dispose();
ManagementScope scope =new ManagementScope("\\\\FullComputerName\\root\\cimv2", options);scope.Connect();
ObjectQuery query = new ObjectQuery("SELECT * FROM Win32_OperatingSystem");
using System.Management;
using System.Security;
public class RemoteConnect
{
public static void Main()
{
SecureString pw = new SecureString();
pw.AppendChar('a');
pw.MakeReadOnly();
ConnectionOptions options = new ConnectionOptions("MS_409", "userName", pw,"ntdlmdomain:DOMAIN",
System.Management.ImpersonationLevel.Impersonate,
System.Management.AuthenticationLevel.Default, true,
null, System.TimeSpan.MaxValue);
pw.Dispose();
ManagementScope scope =new ManagementScope("\\\\FullComputerName\\root\\cimv2", options);scope.Connect();
ObjectQuery query = new ObjectQuery("SELECT * FROM Win32_OperatingSystem");