Integration
Table Of Contents
- View Integration
- Contents
- Introduction
- Integrating with the Event Database
- Using View PowerCLI
- Introduction to View PowerCLI
- View PowerCLI Cmdlets
- View Administrator, View PowerCLI Cmdlet, and vdmadmin Operations
- View PowerCLI Cmdlet Parameters
- Examples of Using View PowerCLI Cmdlets
- Displaying Information About a View Connection Server Instance
- Updating the Configuration of a View Connection Server Instance
- Managing the Configuration of vCenter Servers in View
- Managing Desktop Pools
- Creating and Updating Automatically Provisioned Desktop Pools
- Creating and Updating Linked-Clone Desktop Pools
- Creating and Updating Manually Provisioned Desktop Pools
- Creating Manual Unmanaged Desktop Pools
- Creating and Updating Desktops Provisioned by RDS Hosts
- Obtaining Information About Users and Groups from Active Directory
- Managing Desktop Entitlements
- Managing Remote Sessions
- Managing Virtual Machines
- Displaying Information About Physical Computers
- Updating the Ownership of Machines
- Displaying Information About Events
- Managing the Global Configuration of View
- Managing View Licenses
- Examples of Using View PowerCLI for Enhanced Functionality
- Assign Multiple Network Labels to a Desktop Pool
- Customizing LDAP Data
- Integrating with SCOM
- View Management Packs
- Name a View Connection Server Group
- Import the View MPs
- View Discovery Script
- Run the Discovery Script
- Display Discovered Objects
- Display Managed Objects
- Views and Monitors
- Enable a Proxy Agent on a Server
- Display Performance Data
- Display Information About an Alert
- Restart a Service
- Exclude a Domain from Connectivity Monitoring
- Close Alerts
- Class and Relationship Definitions
- Examining PCoIP Session Statistics
- Dynamically Setting Desktop Policies with Start Session Scripts
- Index
VMware, Inc. 49
Chapter 3 Using View PowerCLI
}
}
Determining Paths to vSphere Inventory Objects
Define a PowerShell function that uses vSphere PowerCLI to return the full path to a vSphere inventory object.
For a function that you can use to determine datastore paths, see “Determining Paths to vSphere Datastore
Objects” on page 49.
# VVGetInventoryPath
# Parameters
# $InvObject Inventory object in vSphere PowerCLI.
#
# Examples
# VVGetInventoryPath (Get-VM -name myVM)
# VVGetInventoryPath (Get-ResourcePool | Select -first 1)
function VVGetPath($InvObject){
if($InvObject){
$objectType = $InvObject.GetType().Name
$objectBaseType = $InvObject.GetType().BaseType.Name
if($objectType.Contains("DatastoreImpl")){
Write-Error "Use the VVGetDataStorePath function to determine datastore paths."
break
}
if(-not ($objectBaseType.Contains("InventoryItemImpl") -or
$objectBaseType.Contains("FolderImpl") -or
$objectBaseType.Contains("DatacenterImpl") -or
$objectBaseType.Contains("VMHostImpl") ) ){
Write-Error ("The provided object is not an expected vSphere object type. Object type
is " + $objectType)
break
}
$path = ""
# Recursively move up through the inventory hierarchy by parent or folder.
if($InvObject.ParentId){
$path = VVGetPath(Get-Inventory -Id $InvObject.ParentId)
} elseif ($InvObject.FolderId){
$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
Define a PowerShell function that 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){