PowerCLI Reference



This cmdlet creates a new datastore.


New-Datastore [-VMHost] <VMHost> [-Name] <String> [-BlockSizeMB <Int32>] [-FileSystemVersion <String>] -Path <String> [-Server <VIServer[]>] [-Vmfs] [-Confirm] [-WhatIf] [<CommonParameters>]

New-Datastore [-VMHost] <VMHost> [-Name] <String> [-FileSystemVersion <String>] [-Kerberos] [-Nfs] -NfsHost <String[]> -Path <String> [-ReadOnly] [-Server <VIServer[]>] [-Confirm] [-WhatIf] [<CommonParameters>]

Related Commands

Online Version

Detailed Description

This cmdlet creates a new datastore based on the provided parameters. The following characters cannot be used in a datastore name: slash (/), backslash (\), and percent (%).


NameTypeDescriptionRequired?Pipeline InputDefault Value
VMHostVMHostSpecifies a host where you want to create the new datastore. Passing multiple values to this parameter is obsolete.trueTrue (ByValue)
NameStringSpecifies a name for the new datastore.trueFalse
BlockSizeMBInt32Specifies the maximum file size of VMFS in megabytes (MB). If no value is given, the maximum file size for the current system platform is used.falseFalse
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
FileSystemVersionStringSpecifies the file system you want to use on the new datastore.falseFalse
KerberosSwitchParameterBy default, NFS datastores are created with AUTH_SYS as the authentication protocol. This parameter indicates that the NFS datastore uses Kerberos version 5 for authentication. This parameter is available only for NFS version 4.1 datastores.falseFalse
NfsSwitchParameterIndicates that you want to create an NFS datastore.falseFalse
NfsHostString[]Specifies the NFS host where you want to create the new datastore.trueFalse
PathStringIf you want to create an NFS datastore, specify the remote path of the NFS mount point. If you want to create a VMFS datastore, specify the canonical name of the SCSI logical unit that will contain new VMFS datastores.trueFalse
ReadOnlySwitchParameterIndicates that the access mode for the mount point is ReadOnly. The default access mode is ReadWrite.falseFalse
ServerVIServer[]Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is passed to this parameter, the command runs on the default servers. For more information about default servers, see the description of Connect-VIServer.falseFalse
VmfsSwitchParameterIndicates that you want to create a VMFS datastore.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

The one or more newly created Datastore objects



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

New-Datastore -VMHost $vmhost -Name Datastore -Path $scsiLun.CanonicalName -Vmfs -FileSystemVersion 3

Creates a VMFS datastore by specifying the file system type.

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

New-Datastore -Nfs -VMHost -Name NFSDatastore -Path /mynfs -NfsHost

Creates a NFS datastore.

-------------------------- Example 3 --------------------------

$vmhost1, $vmhost2 | New-Datastore -Nfs -Name NFS1 -Path "/mnt/nfs1/nfs11/test1" -NfsHost -ReadOnly

Creates a read-only NFS datastore across multiple virtual machine hosts.

Copyright © VMware, Inc. All rights reserved.