I'm trying to connect to another computer using this code:
String FullComputerPathName = @"\\mycomputer\";
ConnectionOptions options = new ConnectionOptions();
options.Password = "some_password";
options.Username = "some_user";
ManagementScope scope = new ManagementScope(FullComputerPathName, options);
scope.Connect();
And got the exception:
The type initializer for 'System.Management.WmiNetUtilsHelper' threw an exception. Inner Excepction: ArgumentNullException: value cannot be null.
The log trace:
"at System.Runtime.InteropServices.Marshal.GetDelegateForFunctionPointer(IntPtr ptr, Type t)
at System.Runtime.InteropServices.Marshal.GetDelegateForFunctionPointer[TDelegate] (IntPtr ptr)
at System.Management.WmiNetUtilsHelper.LoadDelegate[TDelegate](TDelegate& delegate_f, IntPtr hModule,String procName)
at System.Management.WmiNetUtilsHelper...cctor()"
I don't understand what went wrong .
Thank you