-1

I'm trying to access a remote file in the server, but when I execute this code below to open the connection it return "Invalid Namespace".

Anything that I missed?

public static void NetworkAuthentication()
{
    ManagementScope scope =
             new ManagementScope("\\\\192.168.1.12\\Files");
    scope.Options.Username = "ABCDE";
    scope.Options.Password = "12345";
    scope.Connect();
}
stuartd
  • 70,509
  • 14
  • 132
  • 163
H. Eberhardt
  • 79
  • 10
  • Well `\\192.168.1.12\Files` is a UNC path, not a namespace path. – DavidG Oct 13 '15 at 15:43
  • `Files` is not a WMI namespace. [This question](http://stackoverflow.com/questions/659013/accessing-a-shared-file-unc-from-a-remote-non-trusted-domain-with-credentials/684040#684040) may help? – stuartd Oct 13 '15 at 15:44

1 Answers1

1

MSDN says you should use root\cimv2 as namespace. So try

ManagementScope scope = new ManagementScope("\\\\192.168.1.12\\root\\cimv2");
Alexander
  • 560
  • 3
  • 14