Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. WMI Access - Help

WMI Access - Help

Scheduled Pinned Locked Moved C#
helpcomsysadminsecurityquestion
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    wakkerjack
    wrote on last edited by
    #1

    Ive been battling with this prob for a LONG time now.. Using Threads and remote retrieval: i get a rpc error or COm exception sometimes? Like it's retrieving the values, and then it says rpc server unavailable and then if u carry on it will retrieve the next value.. happens with different values.. maybe deadlock occurs? Basically- i use: private ManagementObjectSearcher m_MOSearcher; private ManagementScope m_ManScope; private ConnectionOptions m_ConnectOptions; m_ConnectOptions = new ConnectionOptions (); m_ConnectOptions.Username = "user"; m_ConnectOptions.Password = "pass"; m_ConnectOptions.Authentication = AuthenticationLevel.Call; m_ConnectOptions.Impersonation = ImpersonationLevel.Impersonate; m_ConnectOptions.EnablePrivileges = true; m_ConnectOptions.Locale = "MS_409"; m_ConnectOptions.Timeout = new TimeSpan (0,0,0,0,5); string strConnection = "\\\\"+ "192.168.0.88" + "\\root\\cimv2"; m_ManScope = new ManagementScope(strConnection, m_ConnectOptions); ObjectQuery Temp = new ObjectQuery("SELECT " + "Size" + " FROM Win32_" + "DiskDrive"); m_MOSearcher = new ManagementObjectSearcher (m_ManScope, Temp); foreach(ManagementObject mo in m_MOSearcher.Get()) { Console.WriteLine("Size: " +mo["Size"].ToString ()); } Temp = new ObjectQuery("SELECT " + "Model" + " FROM Win32_" + "DiskDrive"); m_MOSearcher = new ManagementObjectSearcher (m_ManScope, Temp); foreach(ManagementObject mo in m_MOSearcher.Get()) { Console.WriteLine("Model: " +mo["Model"].ToString ()); } And thread it with: for (int i=0; i< 250; i++) { Thread a = new Thread(new ThreadStart(Function)); a.Start(); }

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups