GET-IT: TEAMS DAY | 1-Day Free Virtual Conference all about Teams. Here on Petri.com - 8/12/20 GET-IT: TEAMS DAY - 8/12/20

how to pull members of localgroups?

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

Viewing 1 post (of 1 total)
  • Author
    Posts
  • Avatar
    vivekmohan
    Member
    #143282

    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
    Wscript.Echo
    Next

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.