Datasheet
12 CHAPTER 1
•
AUTOMATING VCENTER SERVER DEPLOYMENT AND CONFIGURATION
Function Export-Folders {
<#
.SYNOPSIS
Creates a csv file of folders in vCenter Server.
.DESCRIPTION
The function will export folders from vCenter Server
and add them to a CSV file.
.NOTES
Source: Automating vSphere Administration
Authors: Luc Dekens, Arnim van Lieshout, Jonathan Medd,
Alan Renouf, Glenn Sizemore
.PARAMETER FolderType
The type of folder to export
.PARAMETER DC
The Datacenter where the folders reside
.PARAMETER Filename
The path of the CSV file to use when exporting
.EXAMPLE 1
PS> Export-Folders -FolderType “Blue” -DC “DC01” -Filename `
“C:\BlueFolders.csv”
.EXAMPLE 2
PS> Export-Folders -FolderType “Yellow” -DC “Datacenter”
-Filename “C:\YellowFolders.csv”
#>
param(
[String]$FolderType,
[String]$DC,
[String]$Filename
)
Process {
If ($Foldertype -eq “Yellow”) {
$type = “host”
} Else {
$type = “vm”
}
$report = @()
$report = get-datacenter $dc | Get-folder $type | `
890790c01.indd 12890790c01.indd 12 3/3/11 10:22:15 AM3/3/11 10:22:15 AM