CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2005
    Posts
    24

    Unhappy Remote WMI Connection issue

    i needed to get the free disk space on a shared remote drive.
    my shared-name goes something like this -- \\RemoteServer\ADrive$

    ConnectionOptions oConn = new ConnectionOptions();
    oConn.Username = "xUser";
    oConn.Password = "xxxx";
    string sSrvName = @" \\RemoteServer\ADrive$";

    ManagementScope oMS = new ManagementScope(sSrvName, oConn);

    I get the error - "Invalid Parameter".
    If i remove the $ sign from the end of the server name and make it something like \\RemoteServer\ADrive
    it goes past the above statement and fails at
    ManagementObjectSearcher oSearcher = new ManagementObjectSearcher(oMS, oQuery) ;
    ManagementObjectCollection oReturnCollection = oSearcher.Get() ;

    with the error - "RPC server is unavailable"

    but when trying to map the above mentioned share drive - \\RemoteServer\ADrive$, via Windows Explorer it works.
    any kind of help is appreciated.

    thanks to all

  2. #2
    Join Date
    May 2009
    Location
    Finland
    Posts
    7

    Re: Remote WMI Connection issue

    Hi,

    Your code looks ok, but what's included in your Object Query parameter oQuery?
    Have you tried some simple query, like what's mentioned in ManagementObjectSearcher Constructor (ManagementScope, ObjectQuery) ?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured