{"id":193,"date":"2013-08-22T18:40:35","date_gmt":"2013-08-22T18:40:35","guid":{"rendered":"http:\/\/www.raykain.com\/?p=193"},"modified":"2013-08-22T18:40:35","modified_gmt":"2013-08-22T18:40:35","slug":"find-all-users-in-domain-and-add-them-to-group","status":"publish","type":"post","link":"https:\/\/www.raykain.com\/?p=193","title":{"rendered":"Find All Users in Domain and Add them to Group"},"content":{"rendered":"<p>Today I need to be able to to grab all users in the domain and add them to a group. I found a couple of examples that would get me part of the way but not finish the job. \u00a0After going around and piecing some others codes together here is what I came up with.<\/p>\n<blockquote><p>$user = Get-ADUser -SearchBase &#8220;DC=&lt;DOMAIN&gt;,DC=&lt;TOPLEVELDOMAIN&gt;&#8221; -Filter *;<\/p>\n<p>$group = Get-ADGroup &#8220;CN=&lt;GROUPNAME&gt;,OU=&lt;LOCATION OF GROUP&gt;,DC=&lt;DOMAIN&gt;,DC=&lt;TOPLEVELDOMAIN&gt;&#8221;;<\/p>\n<p>Add-ADGroupMember $group \u2013Member $user<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>Today I need to be able to to grab all users in the domain and add them to a group. I found a couple of examples that would get me part of the way but not finish the job. \u00a0After going around and piecing some others codes together here is what I came up with. [&hellip;]<\/p>\n","protected":false},"author":1,"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,"_links_to":"","_links_to_target":""},"categories":[4],"tags":[26,30,27,31,32],"class_list":["post-193","post","type-post","status-publish","format-standard","hentry","category-technical","tag-active-directory","tag-ad","tag-powershell","tag-ps1","tag-system-administration"],"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/p16FBG-37","jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/www.raykain.com\/index.php?rest_route=\/wp\/v2\/posts\/193","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.raykain.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.raykain.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.raykain.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.raykain.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=193"}],"version-history":[{"count":2,"href":"https:\/\/www.raykain.com\/index.php?rest_route=\/wp\/v2\/posts\/193\/revisions"}],"predecessor-version":[{"id":195,"href":"https:\/\/www.raykain.com\/index.php?rest_route=\/wp\/v2\/posts\/193\/revisions\/195"}],"wp:attachment":[{"href":"https:\/\/www.raykain.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=193"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.raykain.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=193"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.raykain.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=193"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}