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. 4 simple problems

4 simple problems

Scheduled Pinned Locked Moved C#
sysadmintutorialquestion
4 Posts 3 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.
  • Y Offline
    Y Offline
    Yoyosh 0
    wrote on last edited by
    #1

    1. How to get actual usage of processor? 2.How to get actual usage of RAM ? 3.How to get list of physical drives ? 4.How to get information about network card? I will be very greatfull if you could give me answer to any of that questions, thank you very much in advance! :)

    C 1 Reply Last reply
    0
    • Y Yoyosh 0

      1. How to get actual usage of processor? 2.How to get actual usage of RAM ? 3.How to get list of physical drives ? 4.How to get information about network card? I will be very greatfull if you could give me answer to any of that questions, thank you very much in advance! :)

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      WMI is what you need for most of this. To get the drives is easy, there's an API that returns them all, in System.IO, from memory.

      Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

      Y 1 Reply Last reply
      0
      • C Christian Graus

        WMI is what you need for most of this. To get the drives is easy, there's an API that returns them all, in System.IO, from memory.

        Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

        Y Offline
        Y Offline
        Yoyosh 0
        wrote on last edited by
        #3

        Could you tell me some more about it?

        G 1 Reply Last reply
        0
        • Y Yoyosh 0

          Could you tell me some more about it?

          G Offline
          G Offline
          gnadeem
          wrote on last edited by
          #4

          hi there. to use WMI, visit "http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/wmi\_reference.asp" here is an example to collection physical drive info. namespace: System.Management ConnectionOptions conOpt = new ConnectionOptions(); conOpt.Username="administrator"; conOpt.Password="password"; ManagementScope localScope = new ManagementScope("\\pcgnadeem",conOpt);//computer name ManagementObjectSearcher searcher = new ManagementObjectSearcher(); //searcher.Scope=localScope;//required only for remote computers ObjectQuery query = new ObjectQuery("Select Name from Win32_LogicalDisk Where DriveType=3"); searcher.Query=query; ManagementObjectCollection ResultsCollection = searcher.Get(); foreach(ManagementObject obj in ResultsCollection){ MessageBox.Show(obj["Name"].ToString()); }

          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