How to get the groups a computer is member of in AD with Quest Powershell?

Hi all
I would need a script in Quest PowerShell that gathers the groups that multiple computers are member of in Active Directory. I have this script, but what it does is to get USERNAMES from a .txt file and then display the groups
each user is member of in AD. I couldn't modified it so instead of USERNAMES in the txt file I can put computers name, here's the code:
$out = @()
Get-Content M:\Tools\Reportes_Power_Shell\Contenedor_Power_Shell\Users.txt | ForEach {
$date = (Get-Date).ToString()
$username = $_
$displayName = (Get-QADUser $username -Properties DisplayName).DisplayName
$groups = Get-QADMemberOf $username | Sort-Object Name
ForEach ( $group in $groups ) {
$obj = New-Object -TypeName PSObject
$obj | Add-Member -MemberType NoteProperty -Name Date -Value $date
$obj | Add-Member -MemberType NoteProperty -Name UserName -Value $username
$obj | Add-Member -MemberType NoteProperty -Name DisplayName -Value $displayName
$obj | Add-Member -MemberType NoteProperty -Name GroupName -Value $group.name
$out += $obj
$out | Export-CSV M:\Tools\Reportes_Power_Shell\Reportes_de_Power_Shell_y_AD_Info\Users_Memberships.csv
Thanks!

I did it but didn't work out, I get this error:
Get-QADMemberOf : Ambiguous identity: <NAME OF THE COMPUTER>.
At line:5 char:30
+     $groups = Get-QADMemberOf <<<<  $username | Sort-Object Name
    + CategoryInfo          : NotSpecified: (:) [Get-QADMemberOf], IdentityException
    + FullyQualifiedErrorId : Quest.ActiveRoles.ArsPowerShellSnapIn.BusinessLogic.IdentityException,Quest.ActiveRoles.
   ArsPowerShellSnapIn.Powershell.Cmdlets.GetMemberOfCmdlet
I can't help with Quest, but here's an example using the AD module:
Get-Content .\computerList.txt | ForEach {
$computerName = $_
$props = @{
ComputerName = $computerName
Groups = ''
try {
$details = Get-ADComputer $computerName -Properties memberOf -ErrorAction Stop
$props.Groups = (($details.memberOf | ForEach { (Get-ADGroup $_).Name }) | Sort) -join ','
} catch {
$props.Groups = 'ERROR'
New-Object PsObject -Property $props
} | Select ComputerName,Groups | Export-Csv .\GroupList.csv -NoTypeInformation
Don't retire TechNet! -
(Don't give up yet - 13,085+ strong and growing)

Similar Messages

  • How to get the groups info for user

    Hi guys i am new to ALUI..
    i am trying to do some enhancement.
    i want to know how to get the information of the users group and the group details using the IDK API?
    Can sombody share some code?

    Hello,
    You are welcome. Here is one way of get what you want:
    1) get all groups id's
    IPortletContext - >IRemoteSession -> IUserManager - > getCurrentUserGroups() -> int []
    2) get details about group
    IRemoteSession.getObjectManager(ObjectClass.UserGroup ) ->
    cycle over int []: {
    IObjectManager -> querySingleObject(comminity id) -> IObjectQueryRow -> getName()
    Because you are going to use PRC and make SOAP calls to portal don't forget setup WS to pass token to portlet (check WS settings)
    Edited by Bryazgin at 05/29/2008 7:48 PM

  • LabVIEW 8.0:: How to get the group name of a user logged to a NI Security Domain?

    Hello all,
    I am using LabVIEW 8.0 PDS.
    I created a new local domain called "MyDomain" in the "NI Domain Account Manager" . I added a new User called "MyUser" and a new group called "Maintenance". I set "MyUser" to be a member of the "Maintenance" group. Then, I configured LabVIEW to invoke the login dialog at start-up in order to log "MyUser" with the correct password.
    I would like to get the group name of the current user logged programmatically in a VI. I tried with the VI Server >> Application >> Security properties and methods and also with the properties and methods of the NI Security Class but it seems to be not so simple as I believed at start.
    I do not find any informations or KB on this (all the documents I found deal with LV DSC or TestStand).
     The final goal is to be able to manage a list of user for my application. Each user is a member of a group ("Administrator", "Operator", "Maintenance") and depending on the group, the user can or cannot access to some parts of the application.
    Thanks for your help.
    Matthieu
    Eurilogic

    Re,
    Here is a screenshot of this functions...
    If you really own LV DSC 8.2 the best thing to do is to reinstall it.
    Regards, 
    Message Edité par Richard K. le 04-02-2007 04:00 AM
    Richard Keromen
    National Instruments France
    #adMrkt{text-align: center;font-size:11px; font-weight: bold;} #adMrkt a {text-decoration: none;} #adMrkt a:hover{font-size: 9px;} #adMrkt a span{display: none;} #adMrkt a:hover span{display: block;}
    >> Découvrez, en vidéo, les innovations technologiques réalisées en éco-conception
    Attachments:
    security.jpg ‏3841 KB

  • How to get the group totals in report

    HI,
    Iam generating a report to display Storage Location, and Unit of Measures and Material group and also group totals.
    how to display the group totals on the report.
    thank q
    rushi.

    Hi,
    This following report clearly explains how to display the subtotal and grand total of
    the particular field in alv.
    REPORT  YMS_ALVSUBTOTAL.
    *REPORT z_alv_sub_totals .
    TYPE-POOLS: slis.
    DATA: BEGIN OF it_output OCCURS 0,
              var1(8) TYPE n,
              var2(10),
              var3 TYPE I,
          END OF it_output.
    DATA: it_fieldcat TYPE slis_t_fieldcat_alv,
           t_fieldcat TYPE slis_fieldcat_alv,
          it_sort TYPE slis_t_sortinfo_alv,
          t_sort TYPE slis_sortinfo_alv,
          v_repid LIKE sy-repid.
    INITIALIZATION.
      v_repid = sy-repid.
    START-OF-SELECTION.
      PERFORM get_data.
      PERFORM sort_fields.
      PERFORM fill_fieldcat.
      PERFORM list_display.
    *&      Form  GET_DATA
          text
    -->  p1        text
    <--  p2        text
    FORM get_data.
      it_output-var1 = 1000.
      it_output-var2 = 'anupama'.
      it_output-var3 = '10000'.
    it_output-key = 'X'.
      APPEND it_output.
      CLEAR it_output.
      it_output-var1 = 1000.
      it_output-var2 = 'siddhu'.
      it_output-var3 = '20000'.
      APPEND it_output.
      CLEAR it_output.
      it_output-var1 = 1000.
      it_output-var2 = 'chinni'.
      it_output-var3 = '100000'.
      APPEND it_output.
      CLEAR it_output.
      it_output-var1 = 2000.
      it_output-var2 = 'chicchu'.
      it_output-var3 = '10000'.
      APPEND it_output.
      CLEAR it_output.
      it_output-var1 = 2000.
      it_output-var2 = 'candy'.
      it_output-var3 = '10000'.
      APPEND it_output.
      CLEAR it_output.
      it_output-var1 = 1000.
      it_output-var2 = 'anupama'.
      it_output-var3 = '10000'.
      APPEND it_output.
      CLEAR it_output.
      it_output-var1 = 4000.
      it_output-var2 = 'anupama'.
      it_output-var3 = '10000'.
      APPEND it_output.
      CLEAR it_output.
    ENDFORM.                    " GET_DATA
    *&      Form  fill_fieldcat
          text
    -->  p1        text
    <--  p2        text
    FORM fill_fieldcat.
      PERFORM fill_fields USING: 'IT_OUTPUT' 'VAR1' 'Variable 1' ' ',
                                 'IT_OUTPUT' 'VAR2' 'Variable 2' ' ',
                                 'IT_OUTPUT' 'VAR3' 'Variable 3' 'X'.
    ENDFORM.                    " fill_fieldcat
    *&      Form  fill_fields
          text
         -->P_0146   text
         -->P_0147   text
         -->P_0148   text
         -->P_0149   text
    FORM fill_fields USING    value(tabname) TYPE slis_tabname
                              value(fieldname) TYPE slis_fieldname
                              value(seltext_m) LIKE dd03p-scrtext_m
                              value(do_sum) TYPE c.
      t_fieldcat-tabname = tabname.
      t_fieldcat-fieldname = fieldname.
      t_fieldcat-seltext_m  = seltext_m.
      IF do_sum = 'X'.
        t_fieldcat-datatype = 'CURR'.
      ENDIF.
      t_fieldcat-do_sum = do_sum.
      APPEND t_fieldcat TO it_fieldcat.
      CLEAR t_fieldcat.
    ENDFORM.                    " fill_fields
    *&      Form  list_display
          text
    -->  p1        text
    <--  p2        text
    FORM list_display.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
       EXPORTING
         i_callback_program             = v_repid
         it_fieldcat                    = it_fieldcat
         it_sort                        = it_sort[]
       TABLES
          t_outtab                       = it_output
       EXCEPTIONS
         program_error                  = 1
         OTHERS                         = 2
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " list_display
    *&      Form  sort_fields
          text
    -->  p1        text
    <--  p2        text
    FORM sort_fields.
      t_sort-fieldname = 'VAR1'.
      t_sort-tabname = 'IT_OUTPUT'.
      t_sort-spos = 1.
      t_sort-up = 'X'.
      t_sort-subtot = 'X'.
      APPEND t_sort TO it_sort.
      CLEAR t_sort.
      t_sort-fieldname = 'VAR3'.
      t_sort-tabname = 'IT_OUTPUT'.
      t_sort-spos = 2.
      t_sort-up = 'X'.
      APPEND t_sort TO it_sort.
      CLEAR t_sort.
    ENDFORM.                    " sort_fields
    Thanks,
    Sankar M

  • How to get the group key, which an approval task assign to

    Hi,
    When a user is assign to OIM Group (i.e. from User Detail >> Group Membership form), I will call an approval process (using Access Policy).
    In that approval process, I have defined two tasks.
    1) Assign Approval to Group -> NOT conditional
    2) Remove OIM Group From User -> conditional
    So, from the 1) task, I will assign this approval to a OIM Group.
    If the user click "Approva", a provisioning process will be fired.
    If the user click "Deny" (Reject), 2) task will be run.
    What I want is this.
    From this 2) task, I need to get the "OIM Approval group" key or name (which this approval is assigned to)......
    Note: I need to get this group info in the "Approval Process Task" -> "Integration" -> "Map"
    Regards,
    Chaturanga

    Hi,
    Yes. I have done that.
    Now what I want is this. If the approver "Deny" (Reject) the approval task, I will call another task in the approval process. From that task, I need to run a code, which remove the user from OIM Group.
    So, to do it, I have written a java code and created a adapter. So, as a input parameter for that code, I need to give the approval group name(i.e. the OIM group, above approval task is assign to).
    How can I get the OIM approval group, which the person who Deny the approval belongs to, from this new approval process task???
    Regards,
    Chaturanga

  • How to get the group name of a user

    Hi,
    I am using an openldap for user authentification. How can i retreive the groups name of a user ? I read that i must use the GroupManagerControl class.
    What is the way to specify the openldap authenticator using the above class ?
    Thanks for help.

    Re,
    Here is a screenshot of this functions...
    If you really own LV DSC 8.2 the best thing to do is to reinstall it.
    Regards, 
    Message Edité par Richard K. le 04-02-2007 04:00 AM
    Richard Keromen
    National Instruments France
    #adMrkt{text-align: center;font-size:11px; font-weight: bold;} #adMrkt a {text-decoration: none;} #adMrkt a:hover{font-size: 9px;} #adMrkt a span{display: none;} #adMrkt a:hover span{display: block;}
    >> Découvrez, en vidéo, les innovations technologiques réalisées en éco-conception
    Attachments:
    security.jpg ‏3841 KB

  • How to get the groups associated to a CQ5 user account ?

    Hello,
    I'm looking for a sling endpoints to get all groups a CQ5 user belongs to.
    I first checked into crx but it seems that the groups are not stored in the users nodes. So I've no idea where I should looking at...
    Regards,

    The Sling Jackrabbit UserManager (http://sling.apache.org/site/managing-users-and-groups-jackrabbitusermanager.html) supports this feature. It is not included OOTB in CRX or CQ, but can be added by installing the bundle. See http://forums.adobe.com/thread/922880 for a discussion about installing this bundle.

  • How to get the location of a pageitem when there are pageitems with same UID?

    There are two text frames with same UID but on different pages( also defferent spreads ). What I want to know is how I can get the location of them both.
    The following code can only get the location of the first frame because the second frame has the same UIDRef with the first one(because they are in one document with same UID) .
        InterfacePtr<IGeometry> splineGeo(ItemRef, IID_IGEOMETRY);
        PMMatrix itemPMMatrix = ::InnerToPasteboardMatrix( splineGeo );
        PMRect  itemPMRect = itemGeo->GetStrokeBoundingBox( itemPMMatrix );
    Is there any way I can get the second frame location?
    Thanks a lot.

    No.
    Just copy the pageitems from master page to document page.

  • How to get repitative group a user is member of

    Hi,
    i have a user in our domain who is member of number of groups. This means in MemberOF tab of the user there are larg number of groups. Now i want to remove some groups which are repitated.
    Example -
    1. In MemberOf Tab - properties  tab -- of John, there are 3 DL/SG "Group_1" and "Group_2" and "Group_3".   
    2. Now "Group_3" is a member of "group_1". So i want to remove "Group_3" from the MemberOf Tab of John properties. This will reduce the MemberOf List.  
    3. how to do i find this repetative Groups using powershell ?
    Please let me know if my query is not clear.
    Thanks for your help.

    The following PowerShell script worked well in my test domain. I did not use the AD Module cmdlets, as they are generally slower when you deal with large resultsets (all groups and all users in the domain). This script simply outputs all cases where any
    user is a member of both a group, and a nested member of the group. This will reveal the extent of issue, and whether you want to "correct" all such cases. In place of the statement that outputs the cases, you can add code to "correct"
    it (remove membership in $Member, the child group, for the user).
    # UserNestedGroups.ps1
    # Script to find cases where users are members of both a group and a
    # nested group member of the group.
    # Hash table of groups and their direct group members.
    $GroupMembers = @{}
    # Search entire domain.
    $Domain = [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain()
    $Root =
    $Domain.GetDirectoryEntry()
    $Searcher = [System.DirectoryServices.DirectorySearcher]$Root
    $Searcher.PageSize
    = 200
    $Searcher.SearchScope
    = "subtree"
    $Searcher.PropertiesToLoad.Add("distinguishedName") >
    $Null
    $Searcher.PropertiesToLoad.Add("member") >
    $Null
    # Filter on all group objects.
    $Searcher.Filter =
    "(objectCategory=group)"
    $Results =
    $Searcher.FindAll()
    # Enumerate groups and populate Hash table. The key value will be
    # the Distinguished Name of the group. The item value will be an array
    # of the Distinguished Names of all members of the group that are groups.
    # The item value starts out as an empty array, since we don't know yet
    # which members are groups.
    ForEach ($Group
    In $Results)
        $DN
    = [string]$Group.properties.Item("distinguishedName")
        $Script:GroupMembers.Add($DN, @())
    # Enumerate the groups again to populate the item value arrays.
    # Now we can check each member to see if it is a group.
    ForEach ($Group
    In $Results)
        $DN
    = [string]$Group.properties.Item("distinguishedName")
        $Members
    = @($Group.properties.Item("member"))
        # Enumerate the members of the group.
        ForEach ($Member
    In $Members)
            # Check if the member is a group.
            If ($Script:GroupMembers.ContainsKey($Member))
                # Add the Distinguished Name of this member to the item value array.
                $Script:GroupMembers[$DN] +=
    $Member
    # Retrieve all user objects and their direct group memberships (except primary).
    $Searcher2 = [System.DirectoryServices.DirectorySearcher]$Root
    $Searcher2.PageSize
    = 200
    $Searcher2.SearchScope
    = "subtree"
    $Searcher2.PropertiesToLoad.Add("distinguishedName") >
    $Null
    $Searcher2.PropertiesToLoad.Add("memberOf") >
    $Null
    # Filter on all user objects.
    $Searcher2.Filter =
    "(&(objectCategory=person)(objectClass=user))"
    $Results =
    $Searcher2.FindAll()
    # Enumerate users and their direct group memberships.
    ForEach ($User
    In $Results)
        $DN
    = [string]$User.properties.Item("distinguishedName")
        $Groups
    = @($User.properties.Item("memberOf"))
        ForEach ($Group
    In $Groups)
            # Enumerate all group members of $Group.
            ForEach ($Member
    In $Script:GroupMembers[$Group])
                # Check if user is also a member of $Member.
                If ($Groups
    -Contains $Member)
                    "User $DN is a member of:`n  Parent: $Group`n  Child: $Member"
    Note, if you copy the script above you will need to correct the cases of word wrapping. I try to avoid using scroll bars, even for code.
    Richard Mueller - MVP Directory Services

  • How to get the ID of a dimension member in script logic?

    Hi everybody,
    I am working in some logic scripts and I wonder if exists any option to get the current member ID of a dimension in order to concatenate a string using the member referred and an additional set of caracters such as: MEMBER_ID&"_ccccc".
    Moreover, I would like to use this ID dimension member in order to filter members of another dimension whose attribute is equal to the ID of the desired member. Is it feasible?
    In conclusion, is it possible to get a variable which is referred to a member ID of a dimension, and using it in order to filtering other dimensions?
    Many thanks in advance,
    Antonio

    Hi Antonio,
    You ask if it is possible compare a dimension id with a property value.. yes it is posible , for doing that you will have to do something like this,
    *FOR %ACC1%=ThisA,ThisB,ThisC
          *WHEN DIMENSION.PROPERTY=%ACC1%
                  *REC(............)
           *ENDWHEN
    *NEXT
    if you want to concatenate using a filter theres a posibility, like this example using the time dimension.
    *xdim_memberset time=%year%.jan -
    >2011.jan
    hope it helps

  • How to get the Group ID for the groups in the address book

    There are 2 AddressBooks 'ABook1' and 'ABook2'. Both the AddressBooks have Group named 'Group1' and AddressBook 'ABook2' had a another group 'Group2' which has 'Group1' (from 'ABook1') as one of the members. How can i get to know that which Addressbook is 'Group1' belongs inside the 'Group2' thru the Object API.

    I have never used this function module before, but looking at the coding, I don't think this will serve your purpose.
    I think it might be better to use method(s) from class CL_CRM_DOCUMENTS.
    Via the GET_INFO method you can retrieve the documents you need and using the DELETE method should delete these object. I did use the GET_INFO method etc. but we haven't deleted any objects. But according to the name of the method, it should DELETE the documents.

  • How to get the group an address belongs to?

    Hello,
    I have many groups in my Address Book and I'd like to find in
    which is defined one of my addresses?
    I've tried opening one group after the other, but this is as stupid
    as slow. What is the intelligent way to "see" immediatly which
    group an address belongs to?
    dan

    Thank you Jeffrey.
    I have a second problem related to this "address" searching.
    I was searching for 3 close  addresses which are in my
    "All Contacts" group:
    Company CEO
    Company CSO
    Company Technical Director
    When I select any one of these addresses, they appear within
    my "personnal" group when I press Option key.
    This is quite normal, since I created them within this group by "copy" and "paste".
    Unfortunately, when I open my "personnal" group, I can only see
    the first one of these 3 addresses.
    Where is this "apparent" error coming from?
    dan

  • How to get the current logical system?

    Dear Abapers:
    I can't find the logical system value from the table SYST, pls tell me how to get the current logical system name, Thanks!

    Hi,
    Check with the table T000, the Logical system field name is LOGSYS.
    Regards
    Thiru

  • How to get the coordinate of any character in just a single text frame?

    I am using Illustrator CS5. Better solutions in c# language.

    Hi,
    According to your description, my understanding is that you want to get the groups name of a specific user using Client Object Model PowerShell in SharePoint 2010.
    We can loop the site group collection and the users in each group and then check if the user exists in the user collection.
    ClientContext clientContext = new ClientContext("http://sp/sites/mysite");
    GroupCollection collGroup = clientContext.Web.SiteGroups;
    clientContext.Load(collGroup);
    clientContext.ExecuteQuery();
    User usr = clientContext.Web.EnsureUser(@"contoso\administrator");
    clientContext.Load(usr);
    clientContext.ExecuteQuery();
    foreach (Group group in collGroup)
    UserCollection collUser = group.Users;
    clientContext.Load(collUser);
    clientContext.ExecuteQuery();
    foreach (User user in collUser)
    if (user.LoginName==usr.LoginName)
    Console.WriteLine(group.Title);
    Console.ReadKey();
    For PoweShell command, you can convert the code above to PowerShell Command.
    Here is a detailed article for your reference:
    https://msdn.microsoft.com/en-us/library/ee538244%28v=office.14%29.aspx?f=255&MSPPError=-2147217396
    Thanks
    Best Regards
    Jerry Guo
    TechNet Community Support

  • I tunes has stopped working in windows 7 and I don't know how to get the crash information that everyone else seems to get to know what the cause is....any help?  I have a toshiba windows 7 computer.

    I have a toshiba computer and it is windows 7, recently after I installed imatch everytime I open itunes I get the message 'i tunes has stopped working' and windows cannot find a solution and has to close.  There is no solution and I don't know how to get the crash information on my computer....can anyone help as I want to finish downloading all my songs to match to be available on my mac products.

    Re: That garbage is unreadable.
    If you really want help, stop messing with the fonts and post so that others can read and offer suggestions.
    Or better yet... try a search, I'm certain you'll find a solution to whatever issue you're experiencing.
    I have found that many times it is the things that make you most angry that push you to action. This was the case here. Thank you for causing me to get so angry that I found the answer myself.

Maybe you are looking for

  • My screen broke how can i get apple to fix it i can find where it tells u they fix screens

    hello my screen is broken and i can find how to get it fixed on the apple web site they have no catagory for it saying screen repair i just put random things and where it says put in a detail descripton i said i needed my glass reapired and i said th

  • How do I use ical with ios 107 update?

    I use ical for my dog grooming business & the ical was perfect for it but when I did the update to my ipad it is very difficult to use. On the old one I could look at the month ahead & if I seen a day that I wanted to look at I could just double clic

  • Align like InDesign anchored objects

    I often use anchored text frames in InDesign so that margin text flows with the main body copy. I've attempted to do something similar in Muse, inside a Tabbed Panel. I'm having difficulty aligning the margin text to top of its relevant paragraph. Yo

  • Formatting characters shown in SQL worksheet in version 2.1.1.64

    Hi, Using version 2.1.1.64 When I type SQL in the SQL worksheet is it showing formatting characters - for example all spaces display as a light grey dot and a carriage return character appears at the end of every line. The formatting characters were

  • Retrieve the netboot GUID value from a Hyper-V vm

    I've looked through the pshyperv modules but can't find what I need there so I am hoping that you all can help me.  After creating a new VM, I need to assign it's boot GUID to the new pre-staged computer account.  This is NOT the vm GUID, it's the va