​In a previous post, I wrote about the difference between a Microsoft SharePoint migration and an upgrade. The post resulted in a request from a customer. The customer wanted to perform a migration. In order to migrate the SharePoint content, the customer purchased DocAve 6 Service Pack (SP) 1.

The customer had many site collections in a Microsoft Office SharePoint Server 2007 environment that they wanted to restructure to new site collections in Sharepoint 2010. However, they did not want to create 10,000 migration plans as the job originally required. They were able to automate this process with a feature called DocAve Manager Shell.

DocAve Manager Shell was introduced with the release of DocAve 6. This shell is an extension of the power of Windows PowerShell, to which we have added several cmdlets. With DocAve6 SP1, we have expanded its capabilities even further. To see what we deliver with this feature, use the following PowerShell command:

get-command *da*|more

This command will list all the Windows PowerShell cmdlets which have “da” somewhere in the name, including all DocAve commands, and will show them on a page by page basis.

To go back to the task at hand: I need to create 10,000 migration plans. In order to do that, I need to use the following PowerShell cmdlet:

New-DASP07To10MigrationOnlinePlan

The next step will require some extra information to make sure the plan includes the right source site collection and points to the right target site collection. It needs to use the right agent group in both the source and the target.

Here are the steps we took to do this:

1. Create agent groups using DocAve Manager
2. Create the new site collections in SharePoint 2010 using PowerShell scripts
3. Create a source file in which the following information was stored in a comma separated format:
Planname, source, target, sourceagentgroup, targetagentgroup
4. Create a PowerShell script to read the source file and create the migration plans in DocAve
5. Run this script from the DocAve Manager Shell

Here is an example of the comma separated file:

Content,http://moss2007-demo/demo/content,http://sp2010-wfe1demo/demo/content,moss2007,SP2010
Archiver,http://moss2007-demo/demo/archiver,http://sp2010-wfe1demo/demo/archiver moss2007,SP2010
Connector,http://moss2007-demo/demo/connector,http://sp2010-wfe1demo/demo/connector moss2007,SP2010

I have stored this file as sourcefile.csv at the root of c:\.

Meanwhile, I have created the following PowerShell code to create all the plans:

### Login to the control service
Login-DAManager -ControlHost localhost -ControlPort 14000 -Username admin -PlainTextPassword admin

### Read the file with planname, source site collection and target site collection
$Source = Import-Csv c:\sourcefile.csv -Header planname, source, target, sourceagent, targetagent

### loop through this file and create a plan for each line
foreach ($line in $Source)
{
$plan = Get-DASP07To10MigrationBlankOnlinePlan
$plan.Name = $line.planname
$plan.Description = $line.planname
$plan.SourceFarmName = ‘Farm(SQL-SERVER\DEMO:MOSSWFE1_CONFIG)’
$plan.DestinationFarmName = ‘SP2010-WFE1’
$plan.SourceAgentGroupName = $line.sourceagent
$plan.DestinationAgentGroupName = $line.targetagent
$plan.ProfileName = ‘Default Profile’
$list07 = New-Object DocAve.API.Objects.SharepointSite(‘Farm(SQL-SERVER\DEMO:MOSSWFE1_CONFIG)’, $line.source)
$plan.SourceTree.IncludeSPSite($list07,$true,$false)
$list10 = New-Object DocAve.API.Objects.SharepointSite(‘SP2010-WFE1’, $line.target)
$plan.DestinationTree.SelectSPObject($list10)
$plan.Action = ‘Merge’
#$plan.AssociatedPlanGroup.Add(‘plan group1’)
New-DASP07To10MigrationOnlinePlan $plan

}

I have saved this in the root of c:\ as migration.ps1.

Then I can run the code in the DocAve Manager Shell (c:\migration) and my plans now show up in DocAve Manager.

I hope this example shows you the power of PowerShell combined with DocAve cmdlets.