Jump to content
Sign in to follow this  

Need help on WMI / objects

Recommended Posts


I am new to WMI and am struggling to get Autoit to return what I can do in .VBS

I need to pull a list of all local user users on the machien the scriot runs on

I can do this in the following .vbs but cannot figure how to translate this into AutoIT

All I want to do is put the result of users into a string seperated by a comma.

Hope someone can help

VB Script


Dim objFileSystem, objOutputFile

Dim strOutputFile

' generate a filename base on the script name

strOutputFile = "c:\localUsers.txt"

Set objFileSystem = CreateObject("Scripting.fileSystemObject")

Set objOutputFile = objFileSystem.CreateTextFile(strOutputFile, TRUE)

Set objNetwork = CreateObject("Wscript.Network")

strComputer = objNetwork.ComputerName

Set colAccounts = GetObject("WinNT://" & strComputer & "")

colAccounts.Filter = Array("user")

For Each objUser In colAccounts

objOutputFile.WriteLine(objUser.Name )



Set objFileSystem = Nothing

Share this post

Link to post
Share on other sites

Thanks... - That works fine

Could you help me understand by explaining the "ObjGet("WinNT://" & @ComputerName & "" )"

I am using VBSEdit to browse all the WMI objects and I cannot find which Object the @ComputerName matches..... It obviously is not listed in the WMI objects.??

Where can I find this object listed as it appears it holds an array of all users. It probably also holds information on other things ...

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this