File share migration – Phase 1 – Discovery


Many organizations are struggling to meet the end of support deadline for Windows 2003 servers coming up on July 14, 2015. It’s staggering the number of Windows 2003 file servers still in production out there. This post is the first in a series that deals with file shares migration from Windows 2003 servers to 2012 R2.

As usual, I’m using Powershell to perform this task. This script contains Get-FileShares function and can be downloaded from the Microsoft Script Center Repository.

This function provides file share information from one or more Windows file servers. This is intended to run from a domain joined Windows 8.1 workstation against one or more file servers in the same domain. However, the source file servers can be Windows 2003 and up as long as Powershell 2.0 or up is installed, and Powershell remoting is configured. For more information on Powershell for Windows 2003 see this post. The function returns information including server name, share name, description, count of currently connected users, and amount of free space on the drive where the share is located. The function also obtains and saves the registry entries for file shares on the source server(s), and provides link(s) to file(s) location. Function output is displayed to screen and saved to log file.

Here’s an example output of running this script against one Windows 2003 file server:

After running the script to load its functions, I used the command:

$Shares = Get-FileShares -ComputerName NYFILSRV01P-SK3 -Passthru

Migrate-Files-03

The console output is also saved to a log file under .\logs subfolder similar to this one:

Migrate-Files-08

The output can also be viewed in PS ISE:

$Shares | Out-Gridview # shows information in tabular format in PS ISE

Migrate-Files-04

This can also be exported to CSV for viewing in Excel:

$Shares | Export-Csv .\NYFILSRV01P-SK3.csv -NoType

Migrate-Files-05

Note that CSV is not suited to handle complex data types. XML is more suitable for that. However, if you wish to list share permissions in CSV, we can use a small script like:

‘”ServerName”,”ShareName”,”Path”,”ShareUser”,”SharePerms”,”ShareAccess”‘ |
Out-File .\NYFILSRV01P-SK3b.csv -Encoding ascii
$Shares | % {
$ServerName = $_.ServerName
$ShareName = $_.ShareName
$Path = $_.Path
$SharePerms = $_.SharePerms
$ShareAccess = $_.ShareAccess
$i = 0
$_.ShareUser | % { “””$ServerName””,””$ShareName””,””$Path””,””$_””,””$(if ($SharePerms.Count -ge ($i+1)) {$SharePerms[$i]})””,””$(if ($ShareAccess.Count -ge ($i+1)) {$ShareAccess[$i]})””” | Out-File .\NYFILSRV01P-SK3b.csv -Append -Encoding ascii $i++ }
}

Migrate-Files-07and the output will look like:

Migrate-Files-06

 

Advertisements

3 responses

  1. Pingback: File share migration – Phase 2 – Robocopy | Sam's Corner

  2. Pingback: File share migration – Phase 3 – importing file share information | Sam's Corner

  3. Sophia

    I see too many commands here, lets make it simple. I am currently GS Richcopy 360 to do this task and it works like a charm. User friendly GUI, 100% multi threaded file transfer to get the maximum transfer speed. Give it a try, hope it helps!

    June 11, 2017 at 11:19 am

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s