Home > Uncategorized > Get rid of the file shares with Metalogix and SharePoint

Get rid of the file shares with Metalogix and SharePoint

Get Rid of the file Shares

by cgeier8. November 2010 08:54

We have recently been running a series of workshops on using Metalogix and SharePoint. One piece that really got a lot of attention and good feedback was the portions we did on migrating File Shares to SharePoint. You can certainly get more information on the StoragePoint File Share Librarian functionality we have from one of our webinars or from the video on our website located here


If you are going to be migrating file shares to SharePoint regardless of the tool being used there are some basic steps I think you should be taking. These steps are broad, but could help you get started thinking about your environment. You can see the basic steps in the PowerPoint slide below.


You may be looking at the above and thinking. Gee Great Chris thanks for that information. Now what, how does that really help me?

There are many tools out on the market today to help you with all of this, including some by Metalogix the company I work for. These tools can help you audit all the files you are looking to import, they can also help you filter out files by date or other you may not want to migrate to SharePoint. However! There are a couple tools that you can use RIGHT NOW that can help. They are PowerShell and EXCEL! Yes that’s right you read that correctly. PowerShell and Excel!

Take the example of a Team file share you want to pull into SharePoint. The share is \\server1\Teams. As you saw above the first step is to discover what files are in there, how old they are, what types there are etc. You could go through and manually look at them one by one. Or you could use PowerShell to iterate through and output the results to a CSV file. Simply by running this command:

Get-Childitem –recurse \\server1\Teams |Export-CSV c:\export.csv

This command will start at the \\server1\share and recurse through all the files and directories then export the results to a CSV file.

This creates a CSV file you can open with excel as you can see below.


With the power of excel sorting and filtering I can scroll through and really look at a ton of data about my files. Such as Extension, Last Access Time, Last Write Time etc.

This could be a great help but for some it may be too much. Say you only want to see all the files with exe, MSI, and MP3 extensions? You could use the same command but use the Include parameter

Get-Childitem –recurse \\server1\teams -include *.exe, *.MSI, *.MP3 |Export-CSV C:\export.csv

Or if you want to narrow down your list by excluding files you don’t care about like Doc, XLS, and PPT since these are natural files to migrate.

Get-Childitem –recurse \\server1\teams -exclude *.doc, *.xls, *.ppt |Export-CSV C:\export.csv

At this point you have done a discovery, you can run these PowerShell commands and use excel to sort filter document and do just about anything you want.

Now you have to work on cleaning out items you don’t want to make its way into SharePoint. Once again there are many utilities that make this part of the migration or import process including File Share Librarian’s exclude operation. However you can do some cleaning with PowerShell as well. When you come up with a list of files you want to get rid of such as all the MSI files in the \\server1\Teams\IT directory, you can use the Remove-Item to get rid of them.

Remove-item \\server1\Teams\It \*.pptx -recurse

You could also do something a little more fun.

get-childitem \\server1\teams\it -include *.MSI -recurse | foreach ($_) {remove-item $_.fullname}

However remember the step in this process called test! You can use a parameter on the powershell command to test before you actually remove.

get-childitem \\server1\teams\it -include *.MSI -recurse | foreach ($_) {remove-item $_.fullname -whatif}

The –Whatif command will output what the command would have done, but not do it. Like the shot below if I was to delete all the PPTX files


Running the command with the –Whatif parameter will help you make sure you know exactly what the command would delete.

This can cover file types but that typically is not all the criteria you would use. What if you want to remove OLD files, say anything that has not been modified in the past year? With the magic of PowerShell you can do that!

Get-Childitem e:\storagepoint -recurse |Where-Object {$_.LastWriteTime.Date -le (Get-Date).Date.AddDays(-365)}|foreach {remove-item $_.fullname }

You do have another potential option that can take advantage of that CSV file you are creating. Once you create that export file (CSV) you can delete all the entries of files you wish to keep, thus leaving in all the ones you want to delete. Then use the Import-csv PowerShell command and use that as the input to the remove-item command as follows:

Import-CSV c:\csv.csv | foreach {remove-item $_.fullname }

Magically any file listed in that CSV goes away! This is one where you definitely want to be careful and ensure that you are only listing out files you really want to get rid of!

There is a ton of great information out there on these as well as the other PowerShell commands and if you can’t figure it out call @PaulSchaeflein that’s what I do.

Pasted from <http://blog.storagepoint.com/post/2010/11/08/Get-Rid-of-the-file-Shares.aspx>

Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

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

%d bloggers like this: