Compartilhar via


Move Data Using Windows PowerShell Cmdlets

Applies To: Windows SBS 2008

Windows PowerShell is a command-line shell for Windows, which includes an interactive prompt and a scripting environment. Unlike most shells, which accept and return text, Windows PowerShell is built on top of the .NET common language runtime (CLR) and the .NET Framework, and it accepts and returns .NET objects.

If you add the Microsoft.WindowsServerSolutions.SBS.Powershell.MoveData snap-in to Windows PowerShell, you can use cmdlets (pronounced "command-lets") to move data folders. The following Windows PowerShell 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.

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

  1. Click Start, click Run, type powershell, and then press ENTER.

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

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

  3. 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, click Run, type powershell, and then press ENTER.

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

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

  3. 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, click Run, type powershell, and then press ENTER.

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

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

  3. 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).