PowerCLI Reference

New-Folder

Synopsis

This cmdlet creates a new folder on a vCenter Server system.

Syntax

New-Folder [-Name] <String> [-Location] <VIContainer> [-Server <VIServer[]>] [-WhatIf] [-Confirm] [<CommonParameters>]

Related Commands

Online version
Get-Folder
Move-Folder
Remove-Folder
Set-Folder

Detailed Description

This cmdlet creates a new folder on the specified location.

Parameters

NameTypeDescriptionRequired?Pipeline InputDefault Value
NameStringSpecifies a name for the new folder.truefalse
LocationVIContainerSpecifies a container object (folder, datacenter, or cluster) where you want to place the new folder. If a datacenter is specified for the Location parameter, then the folder is created in its "hostFolder" folder and contains hosts and clusters. The "hostFolder" is a system folder and is guaranteed to exist.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
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
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 newly created Folder object

Notes

Examples

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

New-Folder -Name "Folder1" -Location (Get-Datacenter)[0]

Creates a new folder in a datacenter root.

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

New-Folder -Name "Folder1" -Location (Get-Cluster)[0]

Creates a new folder in a cluster root.

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

Get-Folder | Select -First 1 | New-Folder -Name "Folder2"

Creates a nested folder by using a pipeline command.

-------------- Example 4 --------------

New-Folder -Name "FirstLevelFolder1" -Location (Get-Folder vm)

Creates a new folder in the root vSphere virtual machine folder.


Copyright © VMware, Inc. All rights reserved.