5.2

Table Of Contents
VMware, Inc. 47
Chapter 3 Using View PowerCLI
Set the session timeout to 30 minutes.
Update-GlobalSetting -SessionTimeout 1800
NOTE The -SessionTimeout value is measured in seconds. In View Administrator, the Session timeout value
is measured in minutes. If View PowerCLI generates a value that is less than 60 seconds, View Administrator
rounds down, resulting in a value of 0. To set a session timeout in View PowerCLI, specify a
-SessionTimeout
value of 60 (one minute) or greater.
Set the forced logout warning message and delay period.
Update-GlobalSetting -DisplayLogoffWarning $true -ForcedLogoffAfter $logoutdelay
-ForcedLogoffMessage "Forced log out will occur in $logoutdelay minutes"
Require clients to use SSL to connect and set the prelogin message.
Update-GlobalSetting -UseSSLClient $true -PreLoginMessage "Insert disclaimer and other notices
here."
Managing View Licenses
Display the installed View license keys.
Get-License
Add a license key.
Set-License -key "08A25-0212B-0212C-4D42E"
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