Visual Basic.NET
  Home arrow Visual Basic.NET arrow Listing/Modifying Server Information with ...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
VISUAL BASIC.NET

Listing/Modifying Server Information with Visual Basic.NET and VBScript Using WMI
By: Jagadish Chaterjee
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 8
    2005-12-13

    Table of Contents:
  • Listing/Modifying Server Information with Visual Basic.NET and VBScript Using WMI
  • Listing minimum server information using WMI
  • How to retrieve all user account information using WMI
  • How to retrieve all group information along with account information using WMI
  • How to change your computer name using WMI

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Listing/Modifying Server Information with Visual Basic.NET and VBScript Using WMI


    (Page 1 of 5 )

    This article explains how you can retrieve Windows server information using both Visual Basic.NET and VBScript, along with WMI.
    A downloadable file for this article is available here.

    The sample downloadable solution (zip) is entirely developed using Visual Studio.NET 2003 Enterprise Architect on Windows Server 2003 Standard Edition.  But, I am confident that it would work with other versions of Windows (which support .NET 1.1) versions as well.

    Some global routines used for my WMI development

    Let me first address some issues.  I received a lot of feedback from several readers throughout the world on my series “WMI Programming with Visual Basic.NET”.  Almost every one (about 80%) requested that I extend the series with much more useful and helpful information about working with WMI (in the form of tasks).  Some of the readers also asked me to give examples on VBScript as well (and not only VB.NET).

    One should consider that WMI is being updated and enhanced almost every day.  Microsoft is also integrating WMI directly into some of its products. With humble thanks to every reader who encouraged me to write more, I further extend the same series (but with a different naming scheme). I will be including much more useful information, both for developers and system administrators. 

    I keep on extending the same series as much as possible, covering almost all the aspects of WMI.  I strongly suggest you go through my series on “WMI Programming with Visual Basic.NET” before reading this article.  The series even covers “event handling” using WMI with Visual Basic .NET in the form of Windows Service.

    For flexibility in retrieving WMI information (using VB.NET), I frequently used the following simple global routines which would help me to work with other areas of development very easily.

    Public Sub addRow(ByRef dt As DataTable, ByVal p As String, ByVal v As String)
            Dim dr As DataRow
            dr = dt.NewRow
            dr("Property") = p
            dr("Value") = v
            dt.Rows.Add(dr)
        End Sub
    Public Function getStructure() As DataTable
            Dim dt As New DataTable
            dt.Columns.Add(New DataColumn("Property"))
            dt.Columns.Add(New DataColumn("Value"))
            Return dt
        End Function

    Two of my global routines are “getStructure” and “addRow”.  Both are generally used if I have the “Property->value” scenario. “GetStructure” just creates a data table structure and “AddRow” just adds a data row for every data table passed to it.  And similarly, I also have the following two, to work with “UserAccountInformation”.

    Public Function getUserAccountStructure() As DataTable
            Dim dt As New DataTable
            dt.Columns.Add(New DataColumn("FullName"))
            dt.Columns.Add(New DataColumn("Name"))
            dt.Columns.Add(New DataColumn("Domain"))
            dt.Columns.Add(New DataColumn("LocalAccount"))
            Return dt
        End Function
        Public Sub addUserAccountRow(ByRef dt As DataTable, ByVal FullName As String, ByVal Name As String, ByVal Domain As String, ByVal LocalAccount As String)
            Dim dr As DataRow
            dr = dt.NewRow
            dr("FullName") = FullName
            dr("Name") = Name
            dr("Domain") = Domain
            dr("LocalAccount") = LocalAccount
            dt.Rows.Add(dr)
        End Sub

    More Visual Basic.NET Articles
    More By Jagadish Chaterjee


       · I hope you enjoyed this article on how to retrieve information from your server....
     

    VISUAL BASIC.NET ARTICLES

    - User-defined Functions using Visual Basic Ap...
    - Understanding Object Binding in VBA
    - Mastering the Message Box
    - Testing a Windows Forms Application
    - Using Visual Basic.NET Features to Code a Wi...
    - Correcting Code in a Windows Forms Applicati...
    - Write Readable Code and Comments for Windows...
    - How to Code and Test a Windows Forms Applica...
    - Adding Features to a Windows Forms Applicati...
    - How to Design a Windows Forms Application
    - LINQ to XML Programming Using Visual Basic.N...
    - Understanding Delegates using Visual Basic.N...
    - Create a Sudoku Puzzle Generator using VB.NET
    - Entity Creation and Messaging in a VB.NET Te...
    - Movement and Player Statistics in a VB.NET T...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 Hosted by Hostway
    Stay green...Green IT