Datasheet
22 CHAPTER 1
•
AUTOMATING VCENTER SERVER DEPLOYMENT AND CONFIGURATION
A er you’ve set up and tested individual permissions, you can export them to a read-
able, importable format. is eases multiple installations and the transfer of permissions
to further vCenter Servers, and ensures consistency as well. We’ll show you how next.
Exporting Permissions
e script in Listing 1.6 exports all relevant information into a CSV le, which
can later be used to import them back into the same or a di erent vCenter Server.
Exporting the permissions can be a great way to satisfy a security audit or ensure
the relevant departments or users have the correct permissions.
LISTING 1.6
Exporting permissions
Function Export-PermissionsToCSV {
<#
.SYNOPSIS
Exports all Permissions to CSV file
.DESCRIPTION
The function will export all permissions to a CSV
based file for later import
.NOTES
Source: Automating vSphere Administration
Authors: Luc Dekens, Arnim van Lieshout, Jonathan Medd,
Alan Renouf, Glenn Sizemore
.PARAMETER Filename
The path of the CSV file to be created
.EXAMPLE 1
PS> Export-PermissionsToCSV -Filename “C:\Temp\Permissions.csv”
#>
param(
[String]$Filename
)
Process {
$folderperms = get-datacenter | Get-Folder | Get-VIPermission
$vmperms = Get-Datacenter | get-vm | Get-VIPermission
$permissions = get-datacenter | Get-VIpermission
890790c01.indd 22890790c01.indd 22 3/3/11 10:22:16 AM3/3/11 10:22:16 AM