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 6934657
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:59:20+00:00 2026-05-27T11:59:20+00:00

Hi I need to send a WMI query to each system in a domain

  • 0

Hi I need to send a WMI query to each system in a domain (potentially thousands), and WMI queries seem to take a long time to return. So I am reviewing the best ways to send multiple requests using multiple threads, so the process can run in the background and the calls can overlap.

I like the features that BackgroundWorker offers, and I read HERE that it uses the ThreadPool under the covers. I dont really understand though how I would leverage this to serve my purposes. It seems that if I had to send 1000 queries, I could do a loop in which I invoke a new BG worker for each query, and the threadpool will use up to 25(?) threads at one time, and the remaining 975 requests are queued. Is that what happens?

If this is right, I imagine the process of queuing up 1000 requests will itself freeze the UI, so should the queuing loop itself be running in another BG worker?

Is there a problem with invoking other worker threads from a worker thread?

Should I be only creating say 20 BG worker threads and manually launching another when one completes?

Am I understanding this right? Any advice would be much appreciated!

  • 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-27T11:59:21+00:00Added an answer on May 27, 2026 at 11:59 am

    I use the Parallel.ForEach method found in the System.Threading.Tasks namespace.

    Make a List<string> containing all the host names you want to query. Then make a method that takes a string as it’s input and queries it and does whatever it is you’re wanting to do with that data.

    Put them in a ForEach method like this

    Parallel.ForEach(ComputerList, QueryAComputer);
    

    and let it rip. Be sure to call the Dispose() method on ManagementObjects as soon as you don’t need them. I think there’s some kind of issue that causes WMI to break when too many queries are performed at once. Dispose() should help release those resources and prevent deadlock.

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

Sidebar

Related Questions

I need to send a GET request. One of the parameters has URL query
Need to send/receive text messages between user and system. Any solutions available online? Is
I need send certain attributes(say, human readable user name) from server to client after
I've a custom form (created with form API) that need send an uploaded file
I need to send some information on a VxWorks message queue. The information to
I need to send some arguments from the iPhone to a php in the
I need to send emails from my web application (on account creation, password reset,
I need to send this XML <?xml version=1.0 encoding=UTF-8?> <gate> <country>NO</country> <accessNumber>1900</accessNumber> <senderNumber>1900</senderNumber> <targetNumber>4792267523</targetNumber>
I need to send floating point numbers using a UDP connection to a Qt
I need to send data to a hardware device over serial port. I'm using

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.