Move Data Using Windows PowerShell Cmdlets

Applies To: Windows Small Business Server 2011 Standard

The Windows SBS 2011 Standard Move Data PowerShell Host program enables you to use Windows PowerShell cmdlets (pronounced "command-lets") to move data folders. The following cmdlets are available for moving data folders:

  • Get-SBSDataStore: Gets a .NET object that represents the stored data associated with the parameter that is supplied to the cmdlet.

  • Move-SBSDataStore: Moves the stored data to a new drive.

The following values can be used for the Name (or DataStoreName) parameter of the Windows PowerShell cmdlets:

  • Exchange

  • SharePoint

  • WSUS

  • UserShares

  • UserDocuments

  • ClientBackup

The Get-SBSDataStore cmdlet returns a .NET object that contains attributes that are related to the stored data that was defined in the parameter. For example, when you run the Get-SBSDataStore cmdlet and pass in Exchange for the Name parameter, the following information is returned:

Drives: {C:\  409684442}
IsMovable: True
ReasonUnableToMove:
Store: UserShares
AvailableDrives: {F:\, D:\}
NewDrive: F:\
TotalSize: 409684442
RequiredFreeSpace: 409684442

The following procedures explain several ways that you can use the Move-SBSDataStore cmdlet to move folders to a new drive.

You can redirect the output of the Get-SBSDataStore cmdlet to the Move-SBSDataStore cmdlet without defining the destination drive. The destination drive is the first available drive in the AvailableDrives property.

Important

You must use the Move Data PowerShell Host program to run these cmdlets. You cannot run these cmdlets directly in PowerShell.

To use the Move-SBSDataStore cmdlet without specifying the destination drive

  1. Click Start.

  2. In the search box, type cmd.

  3. In the list of results, right-click cmd, and then click Run as administrator. If you are prompted for an administrator password or confirmation, type the password or provide confirmation.

  4. At the command prompt, type cd c:\Program Files\Windows Small Business Server\Bin, and then press ENTER.

  5. Type movedatapowershellhost, and then press ENTER. A PowerShell command prompt appears.

  6. At the PowerShell command prompt, type the following command, and then press ENTER:

    Add-PSSnapin Microsoft.WindowsServerSolutions.SBS.Powershell.MoveData

  7. At the PowerShell command prompt, type the following command, and then press ENTER:

    Get-SBSDataStore <DataStoreName> | Move-SBSDataStore

    For example: Get-SBSDataStore Exchange | Move-SBSDataStore

You can redirect the output of the Get-SBSDataStore cmdlet to the Move-SBSDataStore cmdlet and define the destination drive.

To use the Move-SBSDataStore cmdlet and specify the destination drive

  1. Click Start.

  2. In the search box, type cmd.

  3. In the list of results, right-click cmd, and then click Run as administrator. If you are prompted for an administrator password or confirmation, type the password or provide confirmation.

  4. At the command prompt, type cd c:\Program Files\Windows Small Business Server\Bin, and then press ENTER.

  5. Type movedatapowershellhost, and then press ENTER. A PowerShell command prompt appears.

  6. At the PowerShell command prompt, type the following command, and then press ENTER:

    Add-PSSnapin Microsoft.WindowsServerSolutions.SBS.Powershell.MoveData

  7. At the PowerShell command prompt, type the following command, and then press ENTER:

    Get-SBSDataStore <DataStoreName> | Move-SBSDataStore -drive <DriveLetter>:

    For example: Get-SBSDataStore Exchange | Move-SBSDataStore -drive D:

Note

D: must be one of the available drives that are listed in the AvailableDrives property list.

You can also move data without using the Get-SBSDataStore cmdlet. You can specify the Name parameter and the destination drive directly to the Move-SBSDataStore cmdlet.

To specify the store parameter and destination drive directly to the Move-SBSDataStore cmdlet

  1. Click Start.

  2. In the search box, type cmd.

  3. In the list of results, right-click cmd, and then click Run as administrator. If you are prompted for an administrator password or confirmation, type the password or provide confirmation.

  4. At the command prompt, type cd c:\Program Files\Windows Small Business Server\Bin, and then press ENTER.

  5. Type movedatapowershellhost, and then press ENTER. A PowerShell command prompt appears.

  6. At the PowerShell command prompt, type the following command, and then press ENTER:

    Add-PSSnapin Microsoft.WindowsServerSolutions.SBS.Powershell.MoveData

  7. At the PowerShell command prompt, type the following command, and then press ENTER:

    Move-SBSDataStore <DataStoreName> -drive <DriveLetter>:

    For example: Move-SBSDataStore Exchange -drive D:

You can pass the -log parameter to any cmdlet to create a log file that contains information about the move. The log file is located in the %ProgramFiles%\Windows Small Business Server\Logs folder, and it is named MoveDataCmd.{ProcessId}.log.

Additional resources

For more information about Windows PowerShell, see "Windows PowerShell" at the Microsoft Web site (https://go.microsoft.com/fwlink/?LinkId=102372).