how to pull members of localgroups?

Home Forums Scripting General Scripting how to pull members of localgroups?

Viewing 1 post (of 1 total)
  • Author
  • Avatar

    hi everyone ,

    here is the sample script which capture me the local group in server where i run the script , i need to pull all associcated members of all local groups in that server,

    i tried using objitem.members and memberof but no use

    i am inserting the code for your reference

    vbscript code

    On Error Resume Next
    strComputer = “.”
    Set objWMIService = GetObject(“winmgmts:\” & strComputer & “rootcimv2”)
    Set colItems = objWMIService.ExecQuery _
    (“Select * from Win32_Group Where LocalAccount = True”)
    For Each objItem in colItems
    Wscript.Echo “Caption: ” & objItem.Caption
    Wscript.Echo “Description: ” & objItem.Description
    Wscript.Echo “Domain: ” & objItem.Domain
    Wscript.Echo “Local Account: ” & objItem.LocalAccount
    Wscript.Echo “Name: ” & objItem.Name
    Wscript.Echo “SID: ” & objItem.SID
    Wscript.Echo “SID Type: ” & objItem.SIDType
    Wscript.Echo “Status: ” & objItem.Status

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.