Integration

Table Of Contents
$path = VVGetPath(Get-Folder -Id $InvObject.FolderId)
}
# Build the path, omitting the "Datacenters" folder at the root.
if(-not $InvObject.isChildTypeDatacenter){ # Add object to the path.
$path = $path + "/" + $InvObject.Name
}
$path
}
}
Determining Paths to vSphere Datastore Objects
The following PowerShell function uses vSphere PowerCLI to return the full path to a datastore in a cluster
as specified by a resource pool.
# VVGetDatastorePath
# Parameters
# $Datastore Datastore object in vSphere PowerCLI.
# $ResourcePool Resource pool in cluster.
#
#Example
# VVGetDatastorePath (Get-Datastore "datastore1") (Get-ResourcePool "Resources")
function VVGetDatastorePath($Datastore,$ResourcePool){
if($Datastore -and $ResourcePool){
$dsType = $Datastore.GetType().Name
$rpType = $ResourcePool.GetType().Name
if(-not ($dsType.Contains("Datastore")) ){
Write-Error "The Datastore provided is not a Datastore object."
break
}
if(-not ($rpType.Contains("ResourcePool")) ){
Write-Error "The Resource Pool provided is not a ResourcePool object."
break
}
$ClusterPath = VVGetPath(Get-Inventory -Id $ResourcePool.ParentId)
$path = $ClusterPath + "/" + $Datastore.Name
$path
}
}
Adding and Removing Datastores
You can define PowerShell functions to add and remove datastores.
The PowerShell functions in the following example add and remove a datastore for an automatic pool.
# AddDatastoreToAutomaticPool
# Parameters
# $Pool Pool ID of pool to be updated.
# $Datastore Full path to datastore to be added.
function AddDatastoreToAutomaticPool
{ param ($Pool, $Datastore)
View Integration
48 VMware, Inc.