VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Get the info about specific user account using Win32_Account WMI Class

by Karthikeyan (187 Submissions)
Category: Miscellaneous
Compatability: VB Script
Difficulty: Unknown Difficulty
Originally Published: Tue 11th May 2004
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Get the info about specific user account using Win32_Account WMI Class

Rate Get the info about specific user account using Win32_Account WMI Class



On Error Resume Next
Computer = "."
Set WMIService = GetObject("winmgmts:\\" & Computer & "\root\cimv2")
Set Items = WMIService.ExecQuery("Select * from Win32_Account where Name='Admin'")
Set OutFile = CreateObject("WScript.Shell")
Const ForAppending = 2
Set FileSystem = CreateObject("Scripting.FileSystemObject")
Set TextFile = FileSystem.OpenTextFile ("c:\Accounts2.txt", ForAppending, True)
TextFile.WriteLine "Account information as follows......"
TextFile.WriteLine
For Each Accounts in Items
TextFile.WriteLine "**********************************************************"
TextFile.WriteLine "Caption: " & Accounts.Caption
TextFile.WriteLine "Description: " & Accounts.Description
TextFile.WriteLine "Domain/Workgroup: " & Accounts.Domain
TextFile.WriteLine "Local Account: " & Accounts.LocalAccount
TextFile.WriteLine "Name: " & Accounts.Name
TextFile.WriteLine "SID: " & Accounts.SID
TextFile.WriteLine "SID Type: " & Accounts.SIDType
TextFile.WriteLine "Status: " & Accounts.Status
TextFile.WriteLine "**********************************************************"
Next
TextFile.Close
OutFile.Run "notepad.exe c:\Accounts2.txt",1,True

Download this snippet    Add to My Saved Code

Get the info about specific user account using Win32_Account WMI Class Comments

No comments have been posted about Get the info about specific user account using Win32_Account WMI Class. Why not be the first to post a comment about Get the info about specific user account using Win32_Account WMI Class.

Post your comment

Subject:
Message:
0/1000 characters