PowerCLI Reference

Export-SpbmStoragePolicy

Synopsis

This cmdlet exports the specified storage policy to a file.

Syntax

Export-SpbmStoragePolicy [-FilePath] <String> [-StoragePolicy] <SpbmStoragePolicy> [-Force] [-Server <VIServer>] [-Confirm] [-WhatIf] [<CommonParameters>]

Related Commands

Online Version
Get-SpbmStoragePolicy
Import-SpbmStoragePolicy
New-SpbmStoragePolicy
Remove-SpbmStoragePolicy
Set-SpbmStoragePolicy

Detailed Description

This cmdlet exports the specified storage policy to a file. If the Force parameter is not specified and the destination file exists or the target parent directory does not exist, a terminating error is generated.


If the folder specified for the FilePath parameter exists, the policy name is used to name the target file. The Force and Destination parameters follow the rules described in PowerCLI Usability Guidelines, Destination and Force parameters.

Parameters

NameTypeDescriptionRequired?Pipeline InputDefault Value
FilePathStringSpecifies the path to the file or directory where you want to export the storage policy.trueFalse
StoragePolicySpbmStoragePolicySpecifies the storage policy you want to export.trueTrue (ByValue)
ConfirmSwitchParameterIf the value is $true, indicates that the cmdlet asks for confirmation before running. If the value is $false, the cmdlet runs without asking for user confirmation.falseFalse
ForceSwitchParameterIndicates whether the cmdlet overwrites the existing destination files.falseFalse
ServerVIServerSpecifies the vCenter Server systems on which you want to run the cmdlet. If no value is given to this parameter, the command runs on the default servers. For more information about default servers, see the description of Connect-VIServer.falseFalse
WhatIfSwitchParameterIndicates that the cmdlet is run only to display the changes that would be made and actually no objects are modified.falseFalse

Return Type

System.IO.FileInfo for the exported file

Notes

Works only with vCenter Server 5.5 or later. For more information, see the VMware Storage Policy API Reference: https://pubs.vmware.com/vsphere-60/index.jsp#com.vmware.vspsdk.apiref.doc/right-pane.html

Examples

-------------------------- Example 1 --------------------------

Export-SpbmStoragePolicy -StoragePolicy $policy -FilePath C:\policies\

Exports a storage policy to a file in C:\policies\. If the C:\policies\ directory exists, a file with the name of the policy is created in this directory.

-------------------------- Example 2 --------------------------

Export-SpbmStoragePolicy -StoragePolicy $policy -FilePath C:\policy.xml -Force

Exports a storage policy to the policy.xml file in C:\. If a file with the same name already exists in this location, the file is overwritten.


Note: If you do not use the Force parameter, the command returns an error about the existing file.


Copyright © VMware, Inc. All rights reserved.