<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Migrate Users Archives - the Sysadmin Channel</title>
	<atom:link href="https://thesysadminchannel.com/tag/migrate-users/feed/" rel="self" type="application/rss+xml" />
	<link>https://thesysadminchannel.com/tag/migrate-users/</link>
	<description>Documenting My Life as a System Administrator</description>
	<lastBuildDate>Sat, 22 Sep 2018 18:59:44 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.3</generator>
<site xmlns="com-wordpress:feed-additions:1">144174110</site>	<item>
		<title>Migrate Users Home Folder To A New File Server Using Powershell</title>
		<link>https://thesysadminchannel.com/migrate-users-home-folder-new-file-server-using-powershell/</link>
					<comments>https://thesysadminchannel.com/migrate-users-home-folder-new-file-server-using-powershell/#comments</comments>
		
		<dc:creator><![CDATA[Paul Contreras]]></dc:creator>
		<pubDate>Thu, 23 Aug 2018 18:55:54 +0000</pubDate>
				<category><![CDATA[Powershell]]></category>
		<category><![CDATA[add permissions to folder powershell]]></category>
		<category><![CDATA[Migrate Users]]></category>
		<category><![CDATA[move folders using Robocopy]]></category>
		<category><![CDATA[NTFSSecurity module examples]]></category>
		<category><![CDATA[Take ownership of folder powershell]]></category>
		<guid isPermaLink="false">https://thesysadminchannel.com/?p=739</guid>

					<description><![CDATA[<p>Not too long ago I had a project to decommission an old 2008 R2 server, spin up a new Windows 2016 Server, migrate the data, migrate users and fix the mess of permissions that had been previously set by the&#8230; <a href="https://thesysadminchannel.com/migrate-users-home-folder-new-file-server-using-powershell/" class="more-link">Continue Reading <span class="meta-nav">&#8594;</span></a></p>
<p>The post <a href="https://thesysadminchannel.com/migrate-users-home-folder-new-file-server-using-powershell/">Migrate Users Home Folder To A New File Server Using Powershell</a> appeared first on <a href="https://thesysadminchannel.com">the Sysadmin Channel</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Not too long ago I had a project to decommission an old 2008 R2 server, spin up a new Windows 2016 Server, migrate the data, migrate users and fix the mess of permissions that had been previously set by the admins before my time.  This data was home to the users Home Folder so it was constantly being accessed and there was no time for any downtime.</p>
<p>The tasks that needed to be completed for each folder and each user.</p>
<ul>
<li>Copy the data to new location with all the metadata in tact (Timestamps, attributes etc.. should remain the same).</li>
<li>Modify their Active Directory HomeDrive and HomeDirectory to the remap and point to the new location.</li>
<li>Set NTFS owner permissions on the new folder to .\Administrators.</li>
<li>Grant NTFS permissions to full control for that individual user only.</li>
<li>Test Access.</li>
</ul>
<p>Since I was doing this for several hundred users, it would have taken me forever and a day to do this manually.  I was looking for an automated and effective way to accomplish this task, and Powershell was right up my alley.  Note, you will also need to download the NTFSSecurity Module.  You can check out a post on that <a href="https://thesysadminchannel.com/get-ntfs-access-permissions-using-ntfssecurity-module/" rel="noopener" target="_blank">RIGHT HERE</a> for usage and examples and such.</p>
<h2>Migrate Users Home Folder To A New File Server Using Powershell</h2>
<pre class="brush: powershell; title: ; notranslate">

Function Migrate-UsersToNewHomeFolder {
#requires -Module ActiveDirectory
#requires -Module NTFSSecurity
#requires -RunAsAdministrator
#requires -Version 3.0

&lt;#
.Synopsis
    Ths will update the Active Directory HomeDrive and HomeDirectory, Migrate the files using Robocopy and set the appriopriate permissions.
    For updated help and examples refer to -Online version.
 

.DESCRIPTION
    Ths will update the Active Directory HomeDrive and HomeDirectory, Migrate the files using Robocopy and set the appriopriate permissions.
    For updated help and examples refer to -Online version.


.NOTES   
    Name: Migrate-UsersToNewHomeFolder
    Author: The Sysadmin Channel
    Version: 1.0
    DateCreated: 2018-Jun-09
    DateUpdated: 2017-Jun-09

.LINK
    https://thesysadminchannel.com/migrate-users-home-folder-new-file-server-using-powershell/ -


.EXAMPLE
    For updated help and examples refer to -Online version.

#&gt;

    [CmdletBinding()]
        param(
            [Parameter(
                Mandatory=$true,
                ValueFromPipeline=$true,
                ValueFromPipelineByPropertyName=$true,
                Position=0)]
            [string[]] $UserName,

            [string]   $OldServer = 'PAC-FS01',
            [string]   $NewServer = 'PAC-FS02',
            [string]   $Domain    = 'AD'
            
        )

    BEGIN {}

    PROCESS {
        foreach ($name in $UserName) {
            if ([bool](Get-ADUser -Filter {samaccountname -eq $name} )) {
                Get-ADUser $name | Set-ADUser -HomeDrive H: -HomeDirectory &quot;\\$NewServer\Users\$name&quot;
                robocopy &quot;\\$OldServer\Users\$Name&quot; &quot;\\$NewServer\Users\$Name&quot; /mir /copy:datou /r:1 /w:10
                sleep 2
                Set-NTFSOwner -Path &quot;\\$NewServer\Users\$Name&quot; -Account Administrators
                sleep 2
                Add-NTFSAccess -Path &quot;\\$NewServer\Users\$Name&quot; -Account &quot;$Domain\$name&quot; -AccessRights FullControl -AccessType Allow -AppliesTo ThisFolderSubfoldersAndFiles

            }
        }
    }

    END {}

}

</pre>
<p>So there you have it.  Hopefully this article was able to help you migrate users from one home folder to another.  If you liked this post be sure to check out <a href="https://www.youtube.com/channel/UC9VnUjmZrNG3ithDZmG-S-g" rel="noopener" target="_blank">TheSysadminChannel on Youtube</a>. And if you&#8217;re looking to further your Powershell or SCCM knowledge, be sure to check out <a href="https://amzn.to/2HoPSfw" target="_blank" rel="noopener">Learn Powershell In a Month Of Lunches Book</a> for Powershell and <a href="https://amzn.to/2v6PMXt" target="_blank" rel="noopener">Learn SCCM in a Month of Lunches Book</a> for System Center Configuration Manager.</p>
<p>The post <a href="https://thesysadminchannel.com/migrate-users-home-folder-new-file-server-using-powershell/">Migrate Users Home Folder To A New File Server Using Powershell</a> appeared first on <a href="https://thesysadminchannel.com">the Sysadmin Channel</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://thesysadminchannel.com/migrate-users-home-folder-new-file-server-using-powershell/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">739</post-id>	</item>
	</channel>
</rss>
