{"id":6303,"date":"2021-03-01T17:00:00","date_gmt":"2021-03-01T16:00:00","guid":{"rendered":"https:\/\/www.razumny.no\/?p=6303"},"modified":"2021-02-09T14:20:48","modified_gmt":"2021-02-09T13:20:48","slug":"finding-all-groups-without-a-manager-in-a-specific-ou-in-ad","status":"publish","type":"post","link":"https:\/\/www.razumny.no\/?p=6303","title":{"rendered":"Finding all groups without a manager in a specific OU in AD"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/www.razumny.no\/?p=6301\">Last week<\/a>, I showed you how you can easily find the OU to use when looking for the members of a specific OU. Today, I&#8217;d like to show you how I use that information. The background was that we use AD groups to control access to network shares. In order for IT support to know who is authorized to approve requests for access to these shares, we use the Managed By tab, assigning the owner of the network share as manager:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"410\" height=\"260\" src=\"https:\/\/i0.wp.com\/www.razumny.no\/wp-content\/uploads\/image-47.png?resize=410%2C260&#038;ssl=1\" alt=\"Screenshot of the Managed By tab of the properties for a AD Group\" class=\"wp-image-6305\" srcset=\"https:\/\/i0.wp.com\/www.razumny.no\/wp-content\/uploads\/image-47.png?w=410&amp;ssl=1 410w, https:\/\/i0.wp.com\/www.razumny.no\/wp-content\/uploads\/image-47.png?resize=300%2C190&amp;ssl=1 300w\" sizes=\"auto, (max-width: 410px) 100vw, 410px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Unfortunately, a large number of these groups do not have an assigned owner, making things a little complicated. I was asked to provide a list of these groups so that we can try to find the tickets where they were requested in order to add this information. I started by finding the OU of one of these groups, before building my script.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">First off, I know that I want to get an AD Group, so I use the <code>Get-ADGroup<\/code> command. I added the parameter <code>-LDAPFilter \"(!managedBy=*)\"<\/code> to filter out all those that has an entry in the Managed By field. For the sake of result validation, I tacked on the <code>-Properties<\/code> parameter with the <code>ManagedBy<\/code> value to ensure that it was added to the results. I specified the OU using the <code>-SearchBase<\/code> parameter followed by the OU in question (in quotation marks). In order to more easily manipulate the results, I piped it all to <a href=\"https:\/\/www.razumny.no\/?p=5451\" data-type=\"post\" data-id=\"5451\">export using CSV<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">My final query looked something like this: <code>Get-ADGroup -LDAPFilter \"(!managedBy=*)\" -Properties ManagedBy -SearchBase \"OU=Finance,OU=UserAccounts,DC=FABRIKAM,DC=COM\" | Export-CSV -path .\\GroupsManagedBy.csv<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I opened the output CSV file in Excel, used the <a href=\"https:\/\/www.razumny.no\/?p=5478\" data-type=\"post\" data-id=\"5478\">text to columns<\/a> feature to separate it all to separate columns. Confirming that I had indeed not gotten any results with entries in the ManagedBy field, I copied the list to a separate Excel Workbook <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I filtered out the groups that had a manager specified, and removed all extraneous information before passing the resulting list on to the colleague that had requested it.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Last week, I showed you how you can easily find the OU to use when looking for the members of a specific OU. Today, I&#8217;d like to show you how I use that information. The background was that we use AD groups to control access to network shares. In order for IT support to know [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_hide_featured_image":false,"_jetpack_featured_image_duplicate_dismissed":0,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[615],"tags":[760,1347,1346,1352,1244,1189,1076,1350,1355,1349,969,1353],"class_list":["post-6303","post","type-post","status-publish","format-standard","hentry","category-how-to-2","tag-active-directory","tag-cn","tag-dc","tag-directory-component","tag-export-csv","tag-get-adgroup","tag-ldapfilter","tag-managed-by","tag-managedby","tag-organizational-unit","tag-powershell","tag-searchbase"],"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/p2ukSU-1DF","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":7467,"url":"https:\/\/www.razumny.no\/?p=7467","url_meta":{"origin":6303,"position":0},"title":"PowerShell: Listing Managed by User for groups","author":"Aleksander Nordgarden-R\u00f8dner","date":"08\/09\/2026","format":false,"excerpt":"One of my customers have a set of access groups set up for access to network shares. These all list a user in the Managed By field, because said user is the one who can approve or deny requests for access to these shares. I needed to get a list\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/www.razumny.no\/?cat=820"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":4034,"url":"https:\/\/www.razumny.no\/?p=4034","url_meta":{"origin":6303,"position":1},"title":"AD Group member does not show up in Exchange address book","author":"Aleksander Nordgarden-R\u00f8dner","date":"03\/04\/2017","format":false,"excerpt":"A couple of months ago, a customer sent us a ticket, complaining that a mail group was incomplete. Specifically, his manager was not listed among the recipients. The mail group in question contained all managers, and membership was gained through dedicated active directory (AD) organisational units (OUs), one for the\u2026","rel":"","context":"In &quot;E-mail&quot;","block_context":{"text":"E-mail","link":"https:\/\/www.razumny.no\/?cat=517"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.razumny.no\/wp-content\/uploads\/Hide-this-group-from-address-lists.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.razumny.no\/wp-content\/uploads\/Hide-this-group-from-address-lists.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.razumny.no\/wp-content\/uploads\/Hide-this-group-from-address-lists.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/www.razumny.no\/wp-content\/uploads\/Hide-this-group-from-address-lists.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":2681,"url":"https:\/\/www.razumny.no\/?p=2681","url_meta":{"origin":6303,"position":2},"title":"Unable to make Active Directory group member of another group","author":"Aleksander Nordgarden-R\u00f8dner","date":"22\/12\/2014","format":false,"excerpt":"Some time ago, I was working on a request to limit access to a folder to members of four AD groups.\u00a0Following the established practice at my employer, I created the group to grant access to the folder, and the one to control who has access. I made the latter a\u2026","rel":"","context":"In &quot;How To&quot;","block_context":{"text":"How To","link":"https:\/\/www.razumny.no\/?cat=615"},"img":{"alt_text":"Scope","src":"https:\/\/i0.wp.com\/www.razumny.no\/wp-content\/uploads\/Scope.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":6996,"url":"https:\/\/www.razumny.no\/?p=6996","url_meta":{"origin":6303,"position":3},"title":"PowerShell: &#8220;Some or all identity references could not be translated&#8221;","author":"Aleksander Nordgarden-R\u00f8dner","date":"05\/12\/2022","format":false,"excerpt":"For a whole host of reasons we use scripts to create access controlled file shares, and to create the Active Directory groups that control access to them. Not only is it easier than doing it manually, it also ensures that the group is created in the correct place, that permissions\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/www.razumny.no\/?cat=820"},"img":{"alt_text":"Picture of text:\n\nRetry-Command: Some or all identity references could not be translated.\nAt C:\\Scripts\\Opprette-Styrtomr\u00e5de.ps1:113 char:1\n+ Retry-Command -ScriptBlock {\n+\n+ CategoryInfo\n+ FullyQualified Error Id: Microsoft.\n: NotSpecified: (:) [Write-Error], WriteError Exception\nPowerShell.Commands.WriteError Exception, Retry-Command","src":"https:\/\/i0.wp.com\/www.razumny.no\/wp-content\/uploads\/image-107.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.razumny.no\/wp-content\/uploads\/image-107.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.razumny.no\/wp-content\/uploads\/image-107.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":5333,"url":"https:\/\/www.razumny.no\/?p=5333","url_meta":{"origin":6303,"position":4},"title":"AD: Inspecting object attributes","author":"Aleksander Nordgarden-R\u00f8dner","date":"16\/12\/2019","format":false,"excerpt":"A little while ago, I was asked about when a specific user last logged in with their active directory (AD) user account. While looking up that information was easily done, finding out how to look up the information was a mite more challenging. There are a number of ways of\u2026","rel":"","context":"In &quot;How To&quot;","block_context":{"text":"How To","link":"https:\/\/www.razumny.no\/?cat=615"},"img":{"alt_text":"AD Object Properties window, showing the Attribute Editor tab, with the \"lastLogonTimestamp\" attribute highlighted","src":"https:\/\/i0.wp.com\/www.razumny.no\/wp-content\/uploads\/image-10.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":5265,"url":"https:\/\/www.razumny.no\/?p=5265","url_meta":{"origin":6303,"position":5},"title":"Building a script to find all members of a given group","author":"Aleksander Nordgarden-R\u00f8dner","date":"09\/09\/2019","format":false,"excerpt":"Some time ago, I was asked to provide a list of everyone with access to a specific system. After communicating with the client, it transpired that they were particularly interested in knowing who were the members of a set of Active Directory groups. While this can be done manually, I\u2026","rel":"","context":"In &quot;How To&quot;","block_context":{"text":"How To","link":"https:\/\/www.razumny.no\/?cat=615"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/www.razumny.no\/index.php?rest_route=\/wp\/v2\/posts\/6303","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.razumny.no\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.razumny.no\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.razumny.no\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.razumny.no\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6303"}],"version-history":[{"count":7,"href":"https:\/\/www.razumny.no\/index.php?rest_route=\/wp\/v2\/posts\/6303\/revisions"}],"predecessor-version":[{"id":6315,"href":"https:\/\/www.razumny.no\/index.php?rest_route=\/wp\/v2\/posts\/6303\/revisions\/6315"}],"wp:attachment":[{"href":"https:\/\/www.razumny.no\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6303"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.razumny.no\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6303"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.razumny.no\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6303"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}