{"id":523,"date":"2014-06-12T09:38:02","date_gmt":"2014-06-12T09:38:02","guid":{"rendered":"http:\/\/giraffeit.com\/?p=523"},"modified":"2014-06-12T09:38:02","modified_gmt":"2014-06-12T09:38:02","slug":"psaddusers","status":"publish","type":"post","link":"https:\/\/giraffeit.com\/index.php\/2014\/06\/12\/psaddusers\/","title":{"rendered":"Powershell : add users from one group to another."},"content":{"rendered":"<p>Simple script to add multipe users from one group to another easily.<\/p>\n<p>&nbsp;<\/p>\n<p>Will show on screen error if they already are members of the destination group but carry on going on error.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>======================================================================================<\/p>\n<p>$Source_Group = &#8220;CN=MAC,OU=Test Groups,OU=Groups,OU=GB,,DC=whatever,DC=com&#8221;<\/p>\n<p>$Destination_Group = &#8220;CN=newMAC,OU=Test Groups,OU=Groups,OU=GB,,DC=whatever,DC=com&#8221;<\/p>\n<p>&nbsp;<\/p>\n<p>$Target = Get-ADGroupMember -Identity $Source_Group<\/p>\n<p>foreach ($Person in $Target) {<\/p>\n<p>Add-ADGroupMember -Identity $Destination_Group -Members $Person.distinguishedname<\/p>\n<p>}<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Simple script to add multipe users from one group to another easily. &nbsp; Will show on screen error if they already are members of the destination group but carry on going on error. &nbsp; &nbsp; ====================================================================================== $Source_Group = &#8220;CN=MAC,OU=Test Groups,OU=Groups,OU=GB,,DC=whatever,DC=com&#8221; $Destination_Group = &#8220;CN=newMAC,OU=Test Groups,OU=Groups,OU=GB,,DC=whatever,DC=com&#8221; &nbsp; $Target = Get-ADGroupMember -Identity $Source_Group foreach ($Person in $Target) { &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/giraffeit.com\/index.php\/2014\/06\/12\/psaddusers\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Powershell : add users from one group to another.&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[],"class_list":["post-523","post","type-post","status-publish","format-standard","hentry","category-bog"],"_links":{"self":[{"href":"https:\/\/giraffeit.com\/index.php\/wp-json\/wp\/v2\/posts\/523","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/giraffeit.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/giraffeit.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/giraffeit.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/giraffeit.com\/index.php\/wp-json\/wp\/v2\/comments?post=523"}],"version-history":[{"count":0,"href":"https:\/\/giraffeit.com\/index.php\/wp-json\/wp\/v2\/posts\/523\/revisions"}],"wp:attachment":[{"href":"https:\/\/giraffeit.com\/index.php\/wp-json\/wp\/v2\/media?parent=523"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/giraffeit.com\/index.php\/wp-json\/wp\/v2\/categories?post=523"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/giraffeit.com\/index.php\/wp-json\/wp\/v2\/tags?post=523"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}