EDN Admin
Well-known member
Hi Guys,<br/>
<br/>
I am using the below script to list local users from win2k3 server, my knowledge in VB is zero<br/>
<br/>
<pre class="x_vb strComputer = <span class="x_visualBasic__string "."
<span class="x_visualBasic__keyword Set objWMIService = GetObject(<span class="x_visualBasic__string "winmgmts:" _
& <span class="x_visualBasic__string "{impersonationLevel=impersonate}!\" & strComputer & <span class="x_visualBasic__string "rootcimv2")
<span class="x_visualBasic__keyword Set colItems = objWMIService.ExecQuery _
(<span class="x_visualBasic__string "Select * from Win32_UserAccount Where LocalAccount = True")
<span class="x_visualBasic__keyword For <span class="x_visualBasic__keyword Each objItem in colItems
Wscript.Echo <span class="x_visualBasic__string "Account Type: " & objItem.AccountType
Wscript.Echo <span class="x_visualBasic__string "Caption: " & objItem.Caption
Wscript.Echo <span class="x_visualBasic__string "Description: " & objItem.Description
Wscript.Echo <span class="x_visualBasic__string "Disabled: " & objItem.Disabled
Wscript.Echo <span class="x_visualBasic__string "Domain: " & objItem.Domain
Wscript.Echo <span class="x_visualBasic__string "Full Name: " & objItem.FullName
Wscript.Echo <span class="x_visualBasic__string "Local Account: " & objItem.LocalAccount
Wscript.Echo <span class="x_visualBasic__string "Lockout: " & objItem.Lockout
Wscript.Echo <span class="x_visualBasic__string "Name: " & objItem.Name
Wscript.Echo <span class="x_visualBasic__string "Password Changeable: " & objItem.PasswordChangeable
Wscript.Echo <span class="x_visualBasic__string "Password Expires: " & objItem.PasswordExpires
Wscript.Echo <span class="x_visualBasic__string "Password Required: " & objItem.PasswordRequired
Wscript.Echo <span class="x_visualBasic__string "SID: " & objItem.SID
Wscript.Echo <span class="x_visualBasic__string "SID Type: " & objItem.SIDType
Wscript.Echo <span class="x_visualBasic__string "Status: " & objItem.Status
Wscript.Echo
<span class="x_visualBasic__keyword Next [/code]
<br/>
Please let me know how to get<br/>
Full name (first/last name) -
Group membership -
Creation date of the account -
Last login of the account -
Company - Department -
Organizational unit -
Description -
Account Disabled? -
Account Locked?
The format required for the user listings is Excel.<br/>
<br/>
Thanks,<br/>
<br/>
Alex<br/>
<hr class="sig Alex
View the full article
<br/>
I am using the below script to list local users from win2k3 server, my knowledge in VB is zero<br/>
<br/>
<pre class="x_vb strComputer = <span class="x_visualBasic__string "."
<span class="x_visualBasic__keyword Set objWMIService = GetObject(<span class="x_visualBasic__string "winmgmts:" _
& <span class="x_visualBasic__string "{impersonationLevel=impersonate}!\" & strComputer & <span class="x_visualBasic__string "rootcimv2")
<span class="x_visualBasic__keyword Set colItems = objWMIService.ExecQuery _
(<span class="x_visualBasic__string "Select * from Win32_UserAccount Where LocalAccount = True")
<span class="x_visualBasic__keyword For <span class="x_visualBasic__keyword Each objItem in colItems
Wscript.Echo <span class="x_visualBasic__string "Account Type: " & objItem.AccountType
Wscript.Echo <span class="x_visualBasic__string "Caption: " & objItem.Caption
Wscript.Echo <span class="x_visualBasic__string "Description: " & objItem.Description
Wscript.Echo <span class="x_visualBasic__string "Disabled: " & objItem.Disabled
Wscript.Echo <span class="x_visualBasic__string "Domain: " & objItem.Domain
Wscript.Echo <span class="x_visualBasic__string "Full Name: " & objItem.FullName
Wscript.Echo <span class="x_visualBasic__string "Local Account: " & objItem.LocalAccount
Wscript.Echo <span class="x_visualBasic__string "Lockout: " & objItem.Lockout
Wscript.Echo <span class="x_visualBasic__string "Name: " & objItem.Name
Wscript.Echo <span class="x_visualBasic__string "Password Changeable: " & objItem.PasswordChangeable
Wscript.Echo <span class="x_visualBasic__string "Password Expires: " & objItem.PasswordExpires
Wscript.Echo <span class="x_visualBasic__string "Password Required: " & objItem.PasswordRequired
Wscript.Echo <span class="x_visualBasic__string "SID: " & objItem.SID
Wscript.Echo <span class="x_visualBasic__string "SID Type: " & objItem.SIDType
Wscript.Echo <span class="x_visualBasic__string "Status: " & objItem.Status
Wscript.Echo
<span class="x_visualBasic__keyword Next [/code]
<br/>
Please let me know how to get<br/>
Full name (first/last name) -
Group membership -
Creation date of the account -
Last login of the account -
Company - Department -
Organizational unit -
Description -
Account Disabled? -
Account Locked?
The format required for the user listings is Excel.<br/>
<br/>
Thanks,<br/>
<br/>
Alex<br/>
<hr class="sig Alex
View the full article