Datasheet
SET UP YOUR VCENTER SERVER FOLDER STRUCTURE 9
Install, Con gure, and
Manage the vSphere
Environment
PART I
FIGURE 1.1 Sample CSV layout
In the example CSV le we created, there are two columns. e rst column, Name,
is used to de ne the name of the folder that you wish to create. e second column,
Path, is used to show the path to where this folder is to be created in vCenter Server.
As seen in Figure 1.1, in the Path column all entries begin with
vm\
. is folder will
not be created but is used by the underlying application programming interface
(API). Once you have created the CSV le that contains the layout of your folder
structure, a script can easily read your CSV le and create the structure using the
code shown in Listing 1.2.
LISTING 1.2
Using a CSV fi le to create a vCenter fi le structure
function Import-Folders{
<#
.SYNOPSIS
Imports a csv file of folders into vCenter Server and
creates them automatically.
.DESCRIPTION
The function will import folders from CSV file and create
them in vCenter Server.
.NOTES
Source: Automating vSphere Administration
Authors: Luc Dekens, Arnim van Lieshout, Jonathan Medd,
Alan Renouf, Glenn Sizemore
.PARAMETER FolderType
The type of folder to create
.PARAMETER DC
The Datacenter to create the folder structure
.PARAMETER Filename
The path of the CSV file to use when importing
890790c01.indd 9890790c01.indd 9 3/3/11 10:22:15 AM3/3/11 10:22:15 AM