Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6825887
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:05:01+00:00 2026-05-26T22:05:01+00:00

Summary: is it possible to specify a port to use when querying WMI using

  • 0

Summary: is it possible to specify a port to use when querying WMI using System.Management;

I have a python script under Linux that queries, using WBEM, classes on a number of ESXi servers to check for warnings or errors on various subsystems. Previously, separately, I have written a WPF application that queries a number of WinTel boxes for their disk consumption etc. using WMI.

I am wanting to write a new WPF application that will perform the same function as the script and I thought I would be able to do this with WMI. Below is my testing code with the error handling removed for brevity, SetOptions is a private function that provides the username and password:

 foreach (string hostname in Properties.Settings.Default.Hosts)
     foreach (string WMIclass in Properties.Settings.Default.Classes)
     {
     ObjectQuery Query = new ObjectQuery("SELECT * FROM " + WMIclass);
     ManagementObjectSearcher mos = GetMos(Query, hostname);
     foreach (ManagementObject mo in mos.Get())
         foreach (PropertyData pdc in mo.Properties)
             Debug.WriteLine(pdc.Name + " \t\t: " + pdc.Value);
     }

private ManagementObjectSearcher GetMos(ObjectQuery Query, string Hostname)
{
     ConnectionOptions Options = SetOptions();
     ManagementScope Scope = new ManagementScope("\\\\" + Hostname + "\\root\\cimv2", Options);
     return new ManagementObjectSearcher(Scope, Query);
}

The trouble is I get a RPC unavailable on the remote server. I think that is because I am first trying to establish a RPC call on 135 which is not hosted by an ESX server. My question is how can one specify the port 5989 or is there something straightforward I can use in .net to perform what I need to do. Naively I’m thinking the class structure looks the same between WMI/WBEM surely it can be done :-/

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T22:05:02+00:00Added an answer on May 26, 2026 at 10:05 pm

    As said WMI Classes in .net don’t support WBEM. In the end I ended up writing some code around the VMware.Vim.dll which has some good documentation on what I needed to do.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to use partial structs to achieve something like this: Have an
Is it possible to get jquery validation to show the validation summary using eager
Summary : I have a project using GNU Autotools. I have a pot file.
Quick Summary of Issue I would to run a python script every minute of
Is it possible to force gcc use int instruction for all the system calls,
SUMMARY: When browsing an ASP.NET website using Windows Explorer, popup windows do not borrow
Summary: I'm able to compile a RAD Studio 2009 project using MSBuild on a
Summary: Every field rows of detailsview have 2 td and their first td can
Summary: I want to know if it is possible to do something like this:
Summary: If you use ASP.NET MVC 2's templates to render a DropDownList, how would

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.