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. 47
Chapter 3 Using View PowerCLI
Examples of Using View PowerCLI for Enhanced Functionality
You can create PowerShell functions by combining View PowerCLI and vSphere PowerCLI cmdlets to perform
complex operations such as resizing pools, and adding datastores to desktop pools. The following sections
contain sample functions that you can adapt and apply to your own systems.
Checking if a View Connection Server Instance Is Running
Define a PowerShell function to check if a View Connection Server instance is running, and optionally, start
the service.
# WaitForViewStartup
# Parameters
# $ClearError If $true, clear the $error object on completion.
# $StartBroker If $true, start the service if it is not running.
function WaitForViewStartup
{ param ($ClearError = $true, $StartBroker = $true)
$service = Get-Service wsbroker
if($service -and (Get-Service wstomcat)){
$started = $false
if($service.Status -eq "Stopped"){
if($StartBroker){ # Start the broker if it is not running.
Write-Warning "Connection Broker service is stopped, attempting to start."
$errCountBefore = $error.Count
Start-Service wsbroker
$errCountAfter = $error.Count
if($errorCountAfter -gt $errorCountBefore){
break
}
} else {
Write-Error "Connection Broker service is stopped."
break
}
}
while(!$started){ # Loop until service has completed starting up.
Write-Warning "Waiting for View Connection Server to start."
$errCountBefore = $error.Count
$output = Get-GlobalSetting -ErrorAction SilentlyContinue
$errCountAfter = $error.Count
$started = $true
if($errCountAfter -gt $errCountBefore){
$err = $error[0].ToString()
if($err.Contains("NoQueueHandler")){
$started = $false
Start-Sleep -s 1
} else {
if($ClearError){
$error.Clear()
}
Write-Error $err
break
}
}
if($ClearError){
$error.Clear()
}
}
} else {
Write-Error "The View Connection Server services could not be found. Is the Connection
Server installed?"
}
}