vSphere PowerCLI Reference



Creates a new datastore.


New-Datastore [-Server <VIServer[]>] [-VMHost] <VMHost[]> [-Name] <String> -Path <String> [-Vmfs] [-BlockSizeMB <Int32>] [-FileSystemVersion <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
New-Datastore [-Server <VIServer[]>] [-VMHost] <VMHost[]> [-Name] <String> -Path <String> -NfsHost <String> [-ReadOnly] [-Cifs] -Username <String> -Password <String> [-WhatIf] [-Confirm] [<CommonParameters>]
New-Datastore [-Server <VIServer[]>] [-VMHost] <VMHost[]> [-Name] <String> -Path <String> [-Local] [-WhatIf] [-Confirm] [<CommonParameters>]
New-Datastore [-Server <VIServer[]>] [-VMHost] <VMHost[]> [-Name] <String> -Path <String> [-Nfs] -NfsHost <String> [-ReadOnly] [-WhatIf] [-Confirm] [<CommonParameters>]

Related Commands

Online version

Detailed Description

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
VMHostVMHost[]Specify a host where you want to create the new datastore.truetrue (ByValue)
NameStringSpecify a name for the new datastore.truefalse
BlockSizeMBInt32Specify 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
CifsSwitchParameterIndicate that you want to create a CIFS datastore.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$true
FileSystemVersionStringSpecify the file system you want to use on the new datastore.falsefalse
LocalSwitchParameterIndicate that you want to create a Local datastore.falsefalse
NfsSwitchParameterIndicate that you want to create a NFS datastore.falsefalse
NfsHostStringSpecify the NFS host where you want to create the new datastore.truefalse
PasswordStringSpecify the password you want to use for authentication with the CIFS server.truefalse
PathStringIf you want to create a local datastore, specify the file path to the directory where the virtual machine data is stored.
If you want to create a NFS/CIFS 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.
ReadOnlySwitchParameterIndicate that the access mode for the mount point is ReadOnly. The default access mode is ReadWrite.falsefalse
ServerVIServer[]Specify the vSphere servers 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
UsernameStringSpecify the username you want to use for authentication with the CIFS server.truefalse
VmfsSwitchParameterIndicate that you want to create a VMFS datastore.falsefalse
WhatIfSwitchParameterIndicate that the cmdlet is run only to display the changes that would be made and actually no objects are modified.falsefalse

Return Type




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

New-Datastore -VMHost $host -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 --------------

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

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

Copyright © 1998 - 2011 VMware, Inc. All rights reserved.