Visual Basic WMI System Services
Win32_Account: WMI Group Account Info
     
Posted:   Monday October 28, 2002
Updated:   Monday November 28, 2011
     
Applies to:   VB5, VB6
Developed with:   VB6, Windows XP
OS restrictions:   Windows NT, 2000, XP. See Prerequisites below.
Author:   VBnet - Randy Birch
     

Related:  

 
     
 Prerequisites
Windows Script Host is built into Microsoft Windows 98, 2000, ME and XP. If you are running Windows 95 or NT4, you can download Windows Script Host from the Microsoft Windows Script Technologies Web site at http://msdn.microsoft.com/scripting/. Some information is not returned on non-NT-based systems.

A reference set in Projects / References to the Microsoft WMI Scripting Library.


The Win32_Account abstract WMI class contains information about user accounts and group accounts known to the Windows system. User or group names recognized by a Windows NT domain are descendents (or members) of this class. The Win32_Account class is not included in a default hardware inventory operation.

This demo and illustration shows all the available information from the class.

 BAS Module Code
None.

 Form Code
To a form add a command button (Command1) and a listbox (List1). Set a reference in Projects / References to the Microsoft WMI Scripting Library, and add the following to the form:

Option Explicit
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Copyright ©1996-2011 VBnet/Randy Birch, All Rights Reserved.
' Some pages may also contain other copyrights by the author.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Distribution: You can freely use this code in your own
'               applications, but you may not reproduce 
'               or publish this code on any web site,
'               online service, or distribute as source 
'               on any media without express permission.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Sub Command1_Click()

   Call wmiWin32Account
   
End Sub


Private Sub Form_Load()
   
   Command1.Caption = "Win32_Account"

End Sub


Private Sub wmiWin32Account()
      
   Dim objset  As SWbemObjectSet
   Dim obj     As SWbemObject

   Set objset = GetObject("winmgmts:{impersonationLevel=impersonate}"). _
                                      InstancesOf("Win32_Account")
   
   On Local Error Resume Next

   For Each obj In objset

      With List1
         .AddItem "Caption: " & obj.Caption
         .AddItem "Description: " & obj.Description
         .AddItem "Domain: " & obj.domain
         .AddItem "InstallDate: " & obj.InstallDate
         .AddItem "LocalAccount: " & obj.LocalAccount
         .AddItem "Name: " & obj.Name
         .AddItem "SID: " & obj.SID
         .AddItem "SIDType: " & obj.SIDType
         .AddItem "Status : " & obj.Status
         .AddItem ""
      End With
        
   Next
   
End Sub
 Comments
 

 
 

PayPal Link
Make payments with PayPal - it's fast, free and secure!

 
 
 
 

Copyright ©1996-2011 VBnet and Randy Birch. All Rights Reserved.
Terms of Use  |  Your Privacy

 

Hit Counter