<p>How do I move an active directory group to another organizational unit using Powershell?</p>

<p>ie.</p>

<p>I would like to move the group "IT Department" from:</p>

<pre><code>  (CN=IT Department, OU=Technology Department, OU=Departments,DC=Company,DC=ca)
</code></pre>

<p>to:</p>

<pre><code>  (CN=IT Department, OU=Temporarily Moved Groups, DC=Company,DC=ca)
</code></pre>

[{'answer_id': 80253, 'author': 'Steven Murawski', 'author_id': 1233, 'author_profile': 'https://Stackoverflow.com/users/1233', 'pm_score': 2, 'selected': False, 'text': '<p>I haven\'t tried this yet, but this should do it..</p>\n\n<pre><code>$objectlocation= \'CN=IT Department, OU=Technology Department, OU=Departments,DC=Company,DC=ca\'\n$newlocation = \'OU=Temporarily Moved Groups, DC=Company,DC=ca\'\n\n$from = new-object System.DirectoryServices.DirectoryEntry("LDAP://$objectLocation")\n$to = new-object System.DirectoryServices.DirectoryEntry("LDAP://$newlocation")\n$from.MoveTo($newlocation,$from.name)\n</code></pre>\n'}, {'answer_id': 85685, 'author': 'Eldila', 'author_id': 889, 'author_profile': 'https://Stackoverflow.com/users/889', 'pm_score': 4, 'selected': True, 'text': '<p>Your script was really close to correct (and I really appreciate your response).</p>\n\n<p>The following script is what I used to solve my problem.:</p>\n\n<pre><code>$from = [ADSI]"LDAP://CN=IT Department, OU=Technology Department, OU=Departments,DC=Company,DC=ca"\n$to = [ADSI]"LDAP://OU=Temporarily Moved Groups, DC=Company,DC=ca"\n$from.PSBase.MoveTo($to,"cn="+$from.name)\n</code></pre>\n'}]
['https://Stackoverflow.com/questions/76325', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/889/']