7.0

Table Of Contents
Table 322. Examples of Common Event Reporting Tasks (Continued)
Task Example View PowerCLI cmdlet Syntax
Display all the user events that occurred
during for the last 24 hours
Get-EventReport -viewName user_events -startDate ((Get-
Date).AddDays(-1))
Display all the user events that occurred
during the current year
Get-EventReport -viewName user_events -startDate (Get-Date -
Day 01 -Month 01 -Hour 0 -Minute 0 -Second 0)
Displaying and Updating Global Settings
You can use View PowerCLI cmdlets to display and update global settings for View.
Table 323. Examples of Common Global Settings Management Tasks
Task Example View PowerCLI cmdlet Syntax
Display the global settings
Get-GlobalSetting
Update the session timeout setting
Update-GlobalSetting -SessionTimeout 1800
Update 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."
Displaying and Adding License Keys
You can use the Get-License and Set-License cmdlets to display and add license keys for View.
In this example, the Get-License cmdlet displays the installed license keys.
Get-License
In this example, the Set-License cmdlet adds a license key.
Set-License -key "08A25-0212B-0212C-4D42E"
Examples of Using View PowerCLI to Perform Advanced Tasks
You can combine View PowerCLI and vSphere PowerCLI cmdlets to create PowerShell functions that
perform complex operations, such as resizing pools and adding datastores to desktop pools.
Determining if View Connection Server Is Running
The following PowerShell function determines whether the View Connection Server service is running and
starts the service if it is not running.
# 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.
View Integration
46 VMware, Inc.