Datasheet
14 CHAPTER 1
•
AUTOMATING VCENTER SERVER DEPLOYMENT AND CONFIGURATION
}
}
Export-Folders “Blue” “DC01” “C:\BlueFolders.csv”
Export-VMLocation “DC01” “C:\VMLocation.csv”
Export-Folders “Yellow” “DC01” “C:\YellowFolders.csv”
Importing a Folder Structure
You can import an existing blue or yellow folder structure into vCenter Server
using the
Import-Folders
function previously shown in Listing 1.2. You can also
choose if you would like your VMs moved back into their correct blue folders by
using the
Import-VMLocation
function, as shown in Listing 1.4.
LISTING 1.4
Importing VMs to their blue folders
Function Import-VMLocation {
<#
.SYNOPSIS
Imports the VMs back into their Blue Folders based on
the data from a csv file.
.DESCRIPTION
The function will import VM locations from CSV File
and add them to their correct Blue Folders.
.NOTES
Source: Automating vSphere Administration
Authors: Luc Dekens, Arnim van Lieshout, Jonathan Medd,
Alan Renouf, Glenn Sizemore
.PARAMETER DC
The Datacenter where the folders reside
.PARAMETER Filename
The path of the CSV file to use when importing
.EXAMPLE 1
PS> Import-VMLocation -DC “DC01” -Filename “C:\VMLocations.csv”
#>
param(
[String]$DC,
[String]$Filename
890790c01.indd 14890790c01.indd 14 3/3/11 10:22:15 AM3/3/11 10:22:15 AM