Visual Basic .NET Forums  
Click here to advertise with us

Go Back   Visual Basic .NET Forums > The Break Room > Articles of Interest

Articles of Interest Members posting articles of interest others should read

VB.NET Forums Newsletter Signup:
Email address:


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 09-28-2006, 11:10 AM
JohnH's Avatar
VB.NET Forum Moderator
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: Dec 2005
Location: Norway
Age: 37
Posts: 10,322
Reputation: 1315
JohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond repute
Default WMI Code Creator 1.0

I just came across this WMI Code Creator tool released by Microsoft 2005. First test quickly generated useful code for me. The generated code is version .Net 1.1, but useful in .Net 2.0 too because System.Management namespace wasn't changed much. Current download link.
Quote:
Brief Description
The WMI Code Creator tool allows you to generate VBScript, C#, and VB .NET code that uses WMI to complete a management task such as querying for management data, executing a method from a WMI class, or receiving event notifications using WMI.
On the topic of WMI tools, also don't forget the WMI Tester that is included in Windows system, you can Run it from Start menu (Wbemtest.exe). It's excellent for testing and verifying WQLs when you are uncertain about code or connection.

Most useful link: Windows Management Instrumentation reference at MSDN. (you can also click to get relevant class docs from within WMI Code Creator application)
Attached Images
File Type: jpg wmigen.jpg (49.1 KB, 187 views)
__________________
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 09-28-2006, 12:45 PM
Neal's Avatar
VB.NET Forum Admin
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: Jul 2004
Location: Richmond, VA
Posts: 1,038
Reputation: 152
Neal done a little coding in his/her timeNeal done a little coding in his/her timeNeal done a little coding in his/her timeNeal done a little coding in his/her time
Default

Awesome! Thanks JohnH!
__________________
Neal Culiner
VB.NET Forum Admin
Follow NC Software on Twitter
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 11-22-2006, 1:42 AM
Luc's Avatar
Luc Luc is offline
VB.NET Forum Enthusiast
.NET Framework: .NET 2.0 (VS 2005)
 
Join Date: Nov 2005
Posts: 59
Reputation: 56
Luc is on a distinguished programming path ahead
Default

Thanks it has proven extremly usefull to me!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 11-22-2006, 3:07 AM
JuggaloBrotha's Avatar
VB.NET Forum Moderator
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: Jun 2004
Location: Lansing, MI; USA
Age: 25
Posts: 3,631
Reputation: 396
JuggaloBrotha master of VB.NETJuggaloBrotha master of VB.NETJuggaloBrotha master of VB.NETJuggaloBrotha master of VB.NETJuggaloBrotha master of VB.NETJuggaloBrotha master of VB.NETJuggaloBrotha master of VB.NETJuggaloBrotha master of VB.NETJuggaloBrotha master of VB.NET
Default

holy crap, i downloaded it and noticed that there's a really large .cs file, i think it's the VS2003 C# source file for that program.. which means we can customize it as needed

thanx big time JohnH
__________________
Currently using: VS 2005 & 2008 Pro w/sp1 on Win7 Ultimate x64.


There are 3 kinds of people in the world: Those who can count and those who can't.
4 out of 3 people have trouble with fractions.

Windows has a 64 bit GUI for a set of 32 bit extensions on a 16 bit shell for an 8 bit OS using a 4 bit kernel made by a 2 bit company that can't stand 1 bit of competition.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 05-14-2008, 4:29 PM
JohnH's Avatar
VB.NET Forum Moderator
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: Dec 2005
Location: Norway
Age: 37
Posts: 10,322
Reputation: 1315
JohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond repute
Default

Did you know you can easily generate strongly typed classes for all WMI classes? There is a .Net tool called "Mgmtclassgen.exe" that does this, it can also be done with this short code:
Code:
Public Shared Sub GenerateWMIClass(ByVal name As String)
    Dim m As New Management.ManagementClass(name)
    m.GetStronglyTypedClassCode(Management.CodeLanguage.VB, name & ".vb", "Win32")
    m.Dispose()
End Sub
Usage example:
Code:
GenerateWMIClass("Win32_Printer")
Then add the generated "Win32_Printer.vb" class to the project (Add Existing Item...). As you can see the coding is now far more manageable:
Code:
For Each p As Win32.Printer In Win32.Printer.GetInstances
    p.PrintTestPage()
Next
__________________
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 07-24-2008, 4:41 PM
VB.NET Forum Newbie
.NET Framework: .NET 2.0 (VS 2005)
 
Join Date: Jul 2008
Age: 31
Posts: 4
Reputation: 0
Fellia is on a distinguished programming path ahead
Default

Thanks I can use this!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 09-25-2009, 6:41 AM
JohnH's Avatar
VB.NET Forum Moderator
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: Dec 2005
Location: Norway
Age: 37
Posts: 10,322
Reputation: 1315
JohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond repute
Default

A note about the GetStronglyTypedClassCode generator, it usually produce minor code errors, typically "value = Nothing" with message:
Quote:
Option Strict On disallows operands of type Object for operator '='. Use the 'Is' operator to test for object identity.
Fix these by changing to "value Is Nothing" as explained.
__________________
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





All times are GMT -4. The time now is 6:16 AM.

Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2


For advertising opportunities click here.