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 not working. Did I forget something?

WMI not working. Did I forget something?

Scheduled Pinned Locked Moved C#
csharpvisual-studiocomsysadminsecurity
2 Posts 2 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.
  • J Offline
    J Offline
    junus
    wrote on last edited by
    #1

    Hi folks, today I was trying to do some stuff with WMI. I was trying to solve a problem many people seem to have who drag their laptop from some place to another (eg from home to university). Maybe at home you have one configuration for your networking needs and university makes you use completely different network settings. So basically what i was trying to do is a little application that allows you to save several profiles with configurations (such as IP Addresses, Subnet etc) and assign them when needed. the actual problem appeared when i was trying to utilize WMI to assign an address to a certain network adapter. the code looks pretty much like in this article: http://www.codeproject.com/cs/system/cstcpipwmi.asp The second part of the article contains the assignment of an IPAddress to the adapter. For me this thing isn't working. I dont get any Exceptions, everything just works fine, but nothing happens. I do the InvokeMethod thing (Win32_NetworkAdapterConfiguration.EnableStatic) and that is just it. I dont get a result, the Address stays as it is. the wmi works fine for other stuff such as simply retrieving the adapters to see which ones can be used or are enabled or to see the MAC or whatever. Did anyone of you have problems with wmi? Is maybe even my attempt to solve my original problem wrong (should I even use WMI to do this?) Did i forget to do some security clearance within the framework or something? I use Visual Studio 2005 Professional Edition (VS Version 8.0.50727.42) on a Windows Professional. .NET 2.0 installed etc. Thanx in advance

    D 1 Reply Last reply
    0
    • J junus

      Hi folks, today I was trying to do some stuff with WMI. I was trying to solve a problem many people seem to have who drag their laptop from some place to another (eg from home to university). Maybe at home you have one configuration for your networking needs and university makes you use completely different network settings. So basically what i was trying to do is a little application that allows you to save several profiles with configurations (such as IP Addresses, Subnet etc) and assign them when needed. the actual problem appeared when i was trying to utilize WMI to assign an address to a certain network adapter. the code looks pretty much like in this article: http://www.codeproject.com/cs/system/cstcpipwmi.asp The second part of the article contains the assignment of an IPAddress to the adapter. For me this thing isn't working. I dont get any Exceptions, everything just works fine, but nothing happens. I do the InvokeMethod thing (Win32_NetworkAdapterConfiguration.EnableStatic) and that is just it. I dont get a result, the Address stays as it is. the wmi works fine for other stuff such as simply retrieving the adapters to see which ones can be used or are enabled or to see the MAC or whatever. Did anyone of you have problems with wmi? Is maybe even my attempt to solve my original problem wrong (should I even use WMI to do this?) Did i forget to do some security clearance within the framework or something? I use Visual Studio 2005 Professional Edition (VS Version 8.0.50727.42) on a Windows Professional. .NET 2.0 installed etc. Thanx in advance

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      Does this[^] give you any clues?

      Dave Kreskowiak Microsoft MVP - Visual Basic

      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