# Restore-CVVirtualMachine

This commandlet (cmdlet) functions only for VMware, Hyper-V and vCloud.

The `Restore-CVVirtualMachine` cmdlet performs recovery operations for VMs in your CommCell environment.

Before you can use this cmdlet, you must log on to your CommCell environment using the `Connect-CVServer` cmdlet. For more information, see Connecting to a CommCell Environment with PowerShell.

## Syntax

    Restore-CVVirtualMachine -Name $[String] -ClientName $[String] [-SubclientName $[String]] [-JobId $[int32]] [-CopyPrecedence $[int32]] [-RestoreType {VirtualMachineFiles | FullVirtualMachine}] [-OutofPlace] [-PowerOnAfterRestore] [-OverwriteExisting] [-Force] [-Requestbody $[Object]] [-WhatIf] [-Confirm] [$[CommonParameters]]
    Restore-CVVirtualMachine -Id $[String] [-SubclientName $[String]]] [-JobId $[int32]] [-CopyPrecedence $[int32]] [-RestoreType {VirtualMachineFiles | FullVirtualMachine}] [-OutofPlace] [-PowerOnAfterRestore] [-OverwriteExisting] [-Force]  [-Requestbody $[Object]] [-WhatIf] [-Confirm] [$[CommonParameters]]
    Restore-CVVirtualMachine -ClientObject $[Object] [-SubclientName $[String]] [-JobId $[int32]] [-CopyPrecedence $[int32]] [-RestoreType {VirtualMachineFiles | FullVirtualMachine}] [-OutofPlace] [-PowerOnAfterRestore] [-OverwriteExisting] [-Force] [-Requestbody $[Object]] [-WhatIf] [-Confirm] [$[CommonParameters]]

## Required Parameters

Parameter | Description | Data type | Accepts pipeline input? | Accepts wildcard characters? | Type of parameter
--- | --- | --- | --- | --- | ---
`–Id` | The ID of the source VM that represents the VM GUID. | String | No | No | Named
`–Name` | The name of the source VM. | String | No | No | Named
`–ClientName` | The name of the client that the source VM is associated with. | String | No | No | Named
`–ClientObject` | The object that represents the client that the source VM is associated with. | Object | Yes, by: Value Property name | No | Named

## Optional Parameters

### Commvault Parameters

Parameter | Description | Data type | Values | Accepts pipeline input? | Accepts wildcard characters? | Type of parameter
--- | --- | --- | --- | --- | --- | ---
`-SubclientName` | The name of the subclient. This parameter overrides the default behavior. | String |  | No | No | Named
`-JobId` | The ID of the backup job to use for the restore. | String | The default value is 0. | No | No | Named
`-CopyPrecedence` | The copy precedence of the backup to use for the restore. | Int32 |  | No | No | Named
`-RestoreType` | The type of restore. | String | VirtualMachineFiles FullVirtualMachine | No | No | Named
`-OutofPlace` | Creates an out-of-place virtual machine restore. | SwitchParameter |  | No | No | Named
`-PowerOnAfterRestore` | Powers on the VM after the restore. | SwitchParameter |  | No | No | Named
`-OverwriteExisting` | Overwrites the existing VM or database. | SwitchParameter |  | No | No | Named
`-Requestbody` | PowerShell custom object with request body which contains destination client and destination information or vmFileLevelRestoreOptions for out-of-place restore. | Object |  | No | No | Named

### Microsoft PowerShell Parameters

You can use the following Microsoft PowerShell parameters:

- Debug

- ErrorAction

- ErrorVariable

- OutBuffer

- OutVariable

- PipelineVariable

- Verbose

- WarningAction

- WarningVariable

- Force

- Confirm

- WhatIf

Note

Only a few cmdlets support Force, Confirm, and WhatIf parameters.

For more information, see "About Common Parameters" in the Microsoft PowerShell documentation.

## Input

This cmdlet does not support input.

## Output

A message that indicates whether the restore completed successfully.

## Examples

### Performing a recovery operation from the most recent backup of a VM to the same client in your CommCell environment.

    Restore-CVVirtualMachine -Name TESTVM12 -ClientName VSAQAVCDR.vsatest.commvault.com -SubclientName VMGroup1 -PowerOnAfterRestore -OverwriteExisting

### Performing an out-of-place restore

    PS C:\>$requestbody = @'{
    "destinationClient": {
    "clientName": "testvsvc1.testlab.commvault.com_v2"
    },
    "destinationInfo": [
    {
    "vmware": {
    "esxHost": "172.24.42.9",
    "newName": "va-dummyVM2_DND",
    "dataStore": "HDD_AutoDatastore",
    "resourcePool": "/"
    }
    }
    ]
    } '@ | ConvertFrom-Json
    Restore-CVVirtualMachine -Name va-dummyVM2_DND2 -outofPlace -Requestbody $requestbody -OverwriteExisting

×

Loading...