This document supports the version of each product listed and
supports all subsequent versions until the document is
replaced by a new edition. To check for more recent editions
of this document, see http://www.vmware.com/support/pubs.
EN-002046-00
View Integration
You can find the most up-to-date technical documentation on the VMware Web site at:
http://www.vmware.com/support/
The VMware Web site also provides the latest product updates.
If you have comments about this documentation, submit your feedback to:
3401 Hillview Ave.
Palo Alto, CA 94304
www.vmware.com
2 VMware, Inc.
Contents
View Integration5
Introduction to View Integration7
1
View Components 7
Integration Interfaces to View 8
Integrating View with the Event Database9
2
Event Database Tables and Schemas 9
Connection Broker Events 11
Horizon Agent Events 16
View Administrator Events 17
Event Message Attributes 24
Sample Database Queries and Views 25
Using View PowerCLI27
3
Getting Started with View PowerCLI 27
View Administrator, PowerCLI Cmdlets, and View Command-Line Interfaces Compared 30
View PowerCLI cmdlet Reference 34
View PowerCLI cmdlet Parameters 36
Examples of Using View PowerCLI cmdlets 40
Examples of Using View PowerCLI to Perform Advanced Tasks 46
Assigning Multiple Network Labels to a Desktop Pool 52
VMware, Inc.
Customizing LDAP Data61
4
Introduction to LDAP Configuration Data 61
Modifying LDAP Configuration Data 62
Integrating View with Microsoft SCOM67
5
Setting Up a SCOM Integration 67
Monitoring View in the Operations Manager Console 72
Examining PCoIP Session Statistics with WMI77
6
Using PCoIP Session Statistics 77
General PCoIP Session Statistics 78
PCoIP Audio Statistics 78
PCoIP Imaging Statistics 79
PCoIP Network Statistics 80
PCoIP USB Statistics 81
Examples of Using PowerShell cmdlets to Examine PCoIP Statistics 82
3
View Integration
Setting Desktop Policies with Start Session Scripts83
7
Index89
Obtaining Input Data for a Start Session Script 83
Best Practices for Using Start Session Scripts 83
Preparing a View Desktop to Use a Start Session Script 84
Sample Start Session Scripts 86
4 VMware, Inc.
View Integration
The View Integration document describes how to integrate View™ software with third-party software such
as Windows PowerShell, business intelligence reporting engines, and Microsoft System Center Operations
Manager (SCOM).
Intended Audience
This document is intended for anyone who wants to customize or integrate software to work with View.
The information in this document is written for experienced Windows or Linux system administrators who
are familiar with virtual machine technology and datacenter operations.
VMware, Inc. 5
View Integration
6 VMware, Inc.
Introduction to View Integration1
With View, system administrators can provision desktops and control user access to these desktops. Client
software connects users to virtual machines running in VMware vSphere™, or to physical systems running
within your network environment. In addition, View administrators can configure Remote Desktop Services
(RDS) hosts to provide View desktop and application sessions to client devices.
This chapter includes the following topics:
“View Components,” on page 7
n
“Integration Interfaces to View,” on page 8
n
View Components
You can use View with VMware vCenter Server to create desktops from virtual machines that are running
on VMware ESX® or VMware ESXi™ hosts and deploy these desktops to end users. You can also install
View on RDS hosts to deploy desktops and applications to end users. View uses your existing Active
Directory infrastructure for user authentication and management.
After you create a desktop or application, authorized end users can use Web-based or locally installed client
software to securely connect to centralized virtual machines, back-end physical systems, or RDS hosts.
View consists of the following major components.
View Connection Server
Horizon Agent
Horizon Client
View Administrator
VMware, Inc. 7
A software service that acts as a broker for client connections by
authenticating and then directing incoming user requests to the appropriate
virtual machine, physical system, or RDS host.
A software service that is installed on all guest virtual machines, physical
systems, or RDS hosts to allow them to be managed by View. Horizon Agent
provides features such as connection monitoring, virtual printing, USB
support, and single sign-on.
A software application that communicates with View Connection Server to
enable users to connect to their desktops.
A Web application that enables View administrators to configure View
Connection Server, deploy desktop and application pools, manage machines,
control user authentication, initiate and examine system events, and perform
analytical activities.
NOTE View Administrator is named Horizon Administrator in Horizon 7.
View Integration
vCenter Server
View Composer
A server that acts as a central administrator for ESX/ESXi hosts that are
connected on a network. A vCenter Server instance provides the central
point for configuring, provisioning, and managing virtual machines in the
datacenter.
A software service that is installed on a vCenter Server instance to enable
View to rapidly deploy multiple linked-clone desktops from a single
centralized base image.
Integration Interfaces to View
You can use several interfaces to integrate View with external applications.
Event database
View PowerCLI
Lightweight Directory
Access Protocol (LDAP)
Microsoft System
Center Operations
Manager (SCOM)
You can configure View to record events to a Microsoft SQL Server or Oracle
database. You can then use business intelligence reporting engines to access
and analyze this database.
You can use the PowerShell interface to perform a wide variety of
administration tasks on View components.
You can export and import LDAP configuration data from and into View.
You can create scripts that update this configuration data without accessing
View Administrator directly.
You can monitor the operations of View components from the SCOM
console.
Windows Management
Instrumentation (WMI)
You can examine performance statistics for a PCoIP session.
8 VMware, Inc.
Integrating View with the Event
Database2
You can configure View to record events to a Microsoft SQL Server or Oracle database. View records events
such as end-user actions, administrator actions, alerts that report system failures and errors, and statistical
sampling.
End-user actions include logging and starting desktop and application sessions. Administrator actions
include adding entitlements and creating desktop and application pools. An example of statistical sampling
is recording the maximum number of users over a 24-hour period.
You can use business intelligence reporting engines such as Crystal Reports, IBM Cognos, MicroStrategy 9,
and Oracle Enterprise Performance Management System to access and analyze the event database.
This chapter includes the following topics:
“Event Database Tables and Schemas,” on page 9
n
“Connection Broker Events,” on page 11
n
“Horizon Agent Events,” on page 16
n
“View Administrator Events,” on page 17
n
“Event Message Attributes,” on page 24
n
“Sample Database Queries and Views,” on page 25
n
Event Database Tables and Schemas
View uses database tables to implement the event database. The event database prepends the names of these
tables with a prefix that you define when you set up the database.
Event Database Tables
The following table shows the database tables that implement the event database in View.
Table 2‑1. Event Database Tables
Table NameDescription
eventMetadata and search optimization data for recent events.
event_dataData values for recent events.
event_data_historicalData values for all events.
event_historicalMetadata and search optimization data for all events.
VMware, Inc. 9
View Integration
View records details about events to all the database tables. After a certain period of time has elapsed since
writing an event record, View deletes the record from the event and event_data tables. You can use View
Administrator to configure the time period for which the database keeps a record in the event and
event_data tables.
IMPORTANT View does not restrict the growth of the event_historical and event_data_historical tables. You
must implement a space management policy for these tables.
A unique primary key, EventID, identifies each event that View records in the event and event_historical
tables. View records data values for each event in the event_data and event_data_historical tables. You can
obtain the complete set of information for an event by joining the event and event_data tables or the event_
historical and event_data_historical tables on the EventID column.
The EventType, Severity, and Time columns in the event and event_historical tables identify the type and
severity of an event and the time at which it occurred.
For information about setting up the event database, see the View Installation document.
NOTE Events might be lost if you restart View Connection Server instances while the event database is not
running. For a solution that avoids this problem see http://kb.vmware.com/kb/1021461.
Event Database Schemas
The following table shows the schema for the event and event_historical database tables.
Table 2‑2. Schema for the event and event_historical Tables
Column NameOracle Data TypeSQL Server Data TypeDescription
AcknowledgedSMALLINTtinyintWhether View acknowledged the event.
0 = false
n
1 = true
n
DesktopIdNVARCHAR2(512)nvarchar(512)Desktop ID of the associated pool.
EventIDINTEGERintUnique primary key for the event.
EventTypeNVARCHAR2(512)nvarchar(512)Event name that corresponds to an item
in the message catalog. For example,
BROKER_USERLOGGEDIN.
FolderPathNVARCHAR2(512)nvarchar(512)Full path of the folder that contains the
associated object.
GroupIdNVARCHAR2(512)nvarchar(512)SID of the associated group in Active
Directory.
LUNIdNVARCHAR2(512)nvarchar(512)ID of the LUN that stores the associated
object.
MachineIdNVARCHAR2(512)nvarchar(512)ID of the associated physical or virtual
machine.
ModuleNVARCHAR2(512)nvarchar(512)View component that raised the event.
For example, Admin, Broker, Tunnel,
Framework, Client, or Agent.
ModuleAndEventTextNVARCHAR2(512)nvarchar(512)Event message with values substituted
for attribute parameters.
NodeNVARCHAR2(512)nvarchar(512)Name of the virtual device node.
SeverityNVARCHAR2(512)nvarchar(512)Severity level. For example, INFO,
WARNING, ERROR,
AUDIT_SUCCESS, AUDIT_FAIL.
SourceNVARCHAR2(512)nvarchar(512)Identifier for the source of the event.
10 VMware, Inc.
Chapter 2 Integrating View with the Event Database
Table 2‑2. Schema for the event and event_historical Tables (Continued)
Column NameOracle Data TypeSQL Server Data TypeDescription
ThinAppIdNVARCHAR2(512)nvarchar(512)ID of the associated ThinApp™ object.
TimeTIMESTAMPdatetimeTime at which the event occurred,
measured from the epoch (January 1,
1970).
UserDiskPathIdNVARCHAR2(512)nvarchar(512)ID of the user disk.
UserSIDNVARCHAR2(512)nvarchar(512)SID of the associated user in Active
Directory.
The following table shows the schema for the event_data and event_data_historical database tables.
Table 2‑3. Schema for the event_data and event_data_historical Tables
Column NameOracle Data TypeSQL Server Data TypeDescription
BooleanValueSMALLINTtinyintValue of a Boolean attribute.
0 = false
n
1 = true
n
EventIDINTEGERintUnique primary key for the event.
IntValueINTEGERintValue of an integer attribute.
NameNVARCHAR2(512)nvarchar(512)Attribute name (for example,
UserDisplayName).
StrValueNVARCHAR2(512)nvarchar(512)Value of a string attribute. For other
types of attributes, this column
contains an interpretation of the data
type as a string.
TimeValueTIMESTAMPdatetimeValue of a date and time attribute.
TypeSMALLINTtinyintThe data type of the attribute.
0 = StrValue
n
1 = IntValue
n
2 = TimeValue
n
3 = BooleanValue
n
Connection Broker Events
Connection broker events report View Connection Server-related information, such as desktop and
application sessions, user authentication failures, and provisioning errors.
The BROKER_DAILY_MAX_DESKTOP_SESSIONS event reports the maximum number of concurrent
desktop sessions over a 24-hour period. If a user runs multiple desktop sessions concurrently, each desktop
session is counted separately.
The BROKER_DAILY_MAX_APP_USERS event reports the maximum number of concurrent application
users over a 24-hour period. If a user runs multiple applications concurrently, the user is counted only once.
Short-lived sessions might not be included in the count because the sampling is performed every five
minutes.
The BROKER_VC_DISABLED and BROKER_VC_ENABLED events report the state of the vCenter driver
that View uses to track a vCenter Server instance.
The BROKER_VC_STATUS_* events report the state of a vCenter Server instance.
The following table lists all the event types for View Connection Server.
VMware, Inc. 11
View Integration
Table 2‑4. Connection Broker Events
Event TypeSeverityModuleAndEventText
BROKER_AGENT_OFFLINEBROKER_AGENT_OFF
LINE WARNING
The agent running on machine ${MachineName} has not
responded to queries, marking it as offline
BROKER_AGENT_ONLINEWARNINGThe agent running on machine ${MachineName} is
responding again, but did not send a startup message
BROKER_APPLICATION_LAUNCH_FAILUREERRORUnable to launch from Pool ${PoolId} for user $
{UserDisplayName}: The broker encountered an error while
processing the request, please contact support for assistance
BROKER_APPLICATION_MISSINGWARNINGAt least ${ApplicationMissingCount} applications, including
${ApplicationExecutable}, are not installed on $
{MachineName} in Pool ${PoolId}
BROKER_APPLICATION_NOT_ENTITLEDAUDIT_FAILUnable to launch from Pool ${PoolId} for user $
{UserDisplayName}: User is not entitled to this Pool
BROKER_APPLICATION_PROTOCOL_NOT_SUPP
ORTED
AUDIT_FAILUnable to launch from Pool ${PoolId} for user $
{UserDisplayName}: Requested protocol ${ProtocolId} is not
supported
AUDIT_FAILFailed to add security server ${SecurityServerId}, pairing
password not set
BROKER_SECURITY_SERVER_ADDEDAUDIT_SUCCESSSecurity server ${SecurityServerId} added
BROKER_SVI_ARCHIVE_UDD_FAILEDAUDIT_FAILFailed to archive user data disk ${UserDiskName} to location
${SVIPath}
BROKER_SVI_ARCHIVE_UDD_SUCCEEDEDAUDIT_SUCCESSArchived user data disk ${UserDiskName} to location $
{SVIPath}
BROKER_SVI_ATTACH_UDD_FAILEDAUDIT_FAILFailed to attach user data disk ${UserDiskName} to VM $
{SVIVMID}
BROKER_SVI_ATTACH_UDD_SUCCEEDEDAUDIT_SUCCESSAttached user data disk ${UserDiskName} to VM $
{SVIVMID}
BROKER_SVI_DETACH_UDD_FAILEDAUDIT_FAILFailed to detach user data disk ${UserDiskName} from VM $
{SVIVMID}
BROKER_SVI_DETACH_UDD_SUCCEEDEDAUDIT_SUCCESSDetached user data disk ${UserDiskName} from VM $
{SVIVMID}
BROKER_USER_AUTHFAILED_ACCOUNT_
DISABLED
BROKER_USER_AUTHFAILED_ACCOUNT_
EXPIRED
BROKER_USER_AUTHFAILED_ACCOUNT_
LOCKED_OUT
BROKER_USER_AUTHFAILED_ACCOUNT_
RESTRICTION
BROKER_USER_AUTHFAILED_BAD_USER_
PASSWORD
AUDIT_FAILUser ${UserDisplayName} failed to authenticate because the
account is disabled
AUDIT_FAILUser ${UserDisplayName} failed to authenticate because the
account has expired
AUDIT_FAILUser ${UserDisplayName} failed to authenticate because the
account is locked out
AUDIT_FAILUser ${UserDisplayName} failed to authenticate because of
an account restriction
AUDIT_FAILUser ${UserDisplayName} failed to authenticate because of a
bad username or password
BROKER_USER_AUTHFAILED_GENERALAUDIT_FAILUser ${UserDisplayName} failed to authenticate
BROKER_USER_AUTHFAILED_NO_LOGON_
SERVERS
BROKER_USER_AUTHFAILED_PASSWORD_
EXPIRED
BROKER_USER_AUTHFAILED_PASSWORD_
MUST_CHANGE
BROKER_USER_AUTHFAILED_SECUREID_
AUDIT_FAILUser ${UserDisplayName} failed to authenticate because
there are no logon servers
AUDIT_FAILUser ${UserDisplayName} failed to authenticate because the
password has expired
AUDIT_FAILUser ${UserDisplayName} failed to authenticate because the
password must change
AUDIT_FAILSecurID access denied for user ${UserDisplayName}
ACCESS_DENIED
BROKER_USER_AUTHFAILED_SECUREID_
NEWPIN_REJECTED
BROKER_USER_AUTHFAILED_SECUREID_
WRONG_NEXTTOKEN
BROKER_USER_AUTHFAILED_SECUREID_
WRONG_STATE
BROKER_USER_AUTHFAILED_TIME_
RESTRICTION
AUDIT_FAILSecurID access denied for user ${UserDisplayName} because
new pin was rejected
AUDIT_FAILSecurID access denied for user ${UserDisplayName} because
wrong next token entered
AUDIT_FAILSecurID access denied for user ${UserDisplayName} because
of incorrect state
AUDIT_FAILUser ${UserDisplayName} failed to authenticate because of a
time restriction
BROKER_USER_NOT_AUTHORIZEDAUDIT_FAILUser ${UserDisplayName} has authenticated, but is not
authorized to perform the operation
BROKER_USER_NOT_ENTITLEDAUDIT_FAILUser ${UserDisplayName} has authenticated, but is not
entitled to any Pools
VMware, Inc. 15
View Integration
Table 2‑4. Connection Broker Events (Continued)
Event TypeSeverityModuleAndEventText
BROKER_USERCHANGEDPASSWORDAUDIT_SUCCESSPassword for ${UserDisplayName} has been changed by the
user
BROKER_USERLOGGEDINAUDIT_SUCCESSUser ${UserDisplayName} has logged in
BROKER_USERLOGGEDOUTAUDIT_SUCCESSUser ${UserDisplayName} has logged out
BROKER_VC_DISABLEDINFOvCenter at address ${VCAddress} has been temporarily
disabled
BROKER_VC_ENABLEDINFOvCenter at address ${VCAddress} has been enabled
BROKER_VC_STATUS_CHANGED_CANNOT_
LOGIN
BROKER_VC_STATUS_CHANGED_DOWNINFOvCenter at address ${VCAddress} is down
BROKER_VC_STATUS_CHANGED_INVALID_
CREDENTIALS
BROKER_VC_STATUS_CHANGED_NOT_YET_
CONNECTED
BROKER_VC_STATUS_CHANGED_
RECONNECTING
BROKER_VC_STATUS_CHANGED_UNKNOWNWARNINGThe status of vCenter at address ${VCAddress} is unknown
BROKER_VC_STATUS_CHANGED_UPINFOvCenter at address ${VCAddress} is up
WARNINGCannot log in to vCenter at address ${VCAddress}
WARNINGvCenter at address ${VCAddress} has invalid credentials
INFONot yet connected to vCenter at address ${VCAddress}
INFOReconnecting to vCenter at address ${VCAddress}
Horizon Agent Events
View Agent events report Horizon Agent-related information, such as the users who have logged in to or
disconnected from a specific machine, whether Horizon Agent has shut down on a specific machine, and
whether Horizon Agent has sent a start up message from a specific machine to View Connection Server.
Table 2‑5. Horizon Agent Events
Event TypeSeverityModuleAndEventText
AGENT_CONNECTEDINFOUser ${UserDisplayName} has logged in to a new session on machine $
{MachineName}
AGENT_DISCONNECTEDINFOUser ${UserDisplayName} has disconnected from machine $
{MachineName}
AGENT_ENDEDINFOUser ${UserDisplayName} has logged off machine ${MachineName}
AGENT_PENDINGINFOThe agent running on machine ${MachineName} has accepted an
allocated session for user ${UserDisplayName}
AGENT_PENDING_ EXPIREDWARNINGThe pending session on machine ${MachineName} for user $
{UserDisplayName} has expired
AGENT_RECONFIGUREDINFOMachine ${MachineName} has been successfully reconfigured
AGENT_RECONNECTEDINFOUser ${UserDisplayName} has reconnected to machine ${MachineName}
AGENT_RESUMEINFOThe agent on machine ${MachineName} sent a resume message
AGENT_SHUTDOWNINFOThe agent running on machine ${MachineName} has shut down, this
machine will be unavailable
AGENT_STARTUPINFOThe agent running on machine ${MachineName} has contacted the
connection server and sent a startup message
AGENT_SUSPENDINFOThe agent on machine ${MachineName} sent a suspend message
16 VMware, Inc.
Chapter 2 Integrating View with the Event Database
View Administrator Events
View Administrator events report information about actions that users initiate in View Administrator.
Table 2‑6. View Administrator Events
EventTypeSeverityModuleAndEventText
ADMIN_ADD_DESKTOP_ENTITLEMENTAUDIT_SUCCESS${EntitlementDisplay} was entitled to Pool $
ADMIN_VC_LICINV_ALARM_DISABLEDAUDIT_SUCCESSAlarm on VC server ${VCAddress} for License
Inventory monitoring was disabled as all
Hosts have desktop licenses
ADMIN_VC_REMOVE_FAILEDAUDIT_FAIL${UserDisplayName} failed to remove VC
server ${VCAddress}
ADMIN_VC_REMOVEDAUDIT_SUCCESS${UserDisplayName} removed VC server $
{VCAddress}
VMware, Inc. 23
View Integration
Event Message Attributes
ModuleAndEventText messages use certain attributes. To determine the data type for an attribute, you can
examine its value in the type column in the event_data or event_data_historical table.
Table 2‑7. Attributes that ModuleAndEventText Messages Use
Attribute NameDescription
AdminFolderNameName of a folder that requries privileged access.
AdminPermissionEntityName of an object that requires privileged access.
AdminPrivilegeNameName of an administrative privilege.
AdminRoleNameName of an administrative role.
AdminRoleNewNameNew name of an administrative role.
AttrChangeTypeType of change that was applied to a generic attribute.
AttrNameName of a generic attribute.
AttrValueValue of a generic attribute.
BrokerIdIdentifier of a View Connection Server instance.
BrokerNameName of a View Connection Server instance.
DesktopDisplayNameDisplay name of a desktop pool.
DesktopIdIdentifier of a desktop pool.
EntitlementDisplayDisplay name of a desktop entitlement.
MachineIdName of a physical or virtual machine.
MachineNameName of a physical or virtual machine.
MaintenanceModeMaintenance mode state.
ObjectIDIdentifier of an inventory object.
ObjectTypeType of an inventory object.
PolicyDisplayNameDisplay name of a policy.
PolicyObjectIdentifier of a policy object.
PolicyValueValue of a policy object.
ProtocolIdIdentifier of a display protocol.
SecurityServerIdIdentifier of a security server.
SVIAdminFqdnFQDN of a QuickPrep domain.
SVIAdminIDIdentifier of a QuickPrep domain.
SVIAdminNameName of a QuickPrep domain.
SVIDeploymentGroupIDIdentifier of a View Composer deployment group.
SVIOperationName of a View Composer operation.
SVIParentVMParent virtual machine in View Composer.
SVIPathPath of an object in View Composer.
SVISnapshotSnapshot in View Composer.
SVIVMIDIdentifier of a virtual machine in View Composer.
ThinAppDisplayNameDisplay name of a ThinApp object.
ThinAppIdIdentifier of a ThinApp object.
24 VMware, Inc.
Table 2‑7. Attributes that ModuleAndEventText Messages Use (Continued)
Attribute NameDescription
ThinAppRepositoryNameName of a ThinApp repository
ThinAppRepositoryPathPath of a ThinApp repository.
TimeDate and time value.
UserCountMaximum number of desktop users over a 24-hour period.
UserDiskNameName of a user data disk.
UserDisplayNameUser name in the form DOMAIN\username.
UserNameName of a user in Active Directory.
VCAddressURL of a vCenter Server.
Sample Database Queries and Views
You can query the event_historical database to display error events, warning events, and specific recent
events.
NOTE Replace the dbo.VE_ prefix in the following examples with the appropriate prefix for your event
database.
Chapter 2 Integrating View with the Event Database
List Error Events
The following query displays all error events from the event_historical table.
CREATE VIEW error_events AS
(
SELECT ev.EventID, ev.Time, ev.Module, ev.EventType, ev.ModuleAndEventText
FROM dbo.VE_event_historical AS ev
WHERE ev.Severity = ‘ERROR’
);
List Warning Events
The following query displays all warning events from the event_historical table.
CREATE VIEW warning_events AS
(
SELECT ev.EventID, ev.Time, ev.Module, ev.EventType, ev.ModuleAndEventText
FROM dbo.VE_event_historical AS ev
WHERE ev.Severity = ‘WARNING’
);
List Recent Events
The following query lists all recent events that are associated with the user fred in the domain MYDOM.
CREATE VIEW user_fred_events AS
(
SELECT ev.EventID, ev.Time, ev.Module, ev.EventType, ev.Severity, ev.Acknowledged
FROM dbo.VE_event_historical AS ev,
dbo.VE_event_data_historical AS ed
WHERE ev.EventID = ed.EventID AND ed.Name = 'UserDisplayName' AND ed.StrValue =
‘MYDOM\fred’
);
VMware, Inc. 25
View Integration
The following query lists all recent events where the agent on a machine shut down.
CREATE VIEW agent_shutdown_events AS
(
SELECT ev.EventID, ev.Time, ed.StrValue
FROM dbo.VE_event_historical AS ev,
dbo.VE_event_data_historical AS ed
WHERE ev.EventID = ed.EventID AND ev.EventType = ‘AGENT_SHUTDOWN’ AND
ed.Name = ‘MachineName’
);
The following query lists all recent events where a desktop failed to launch because the desktop pool was
empty.
CREATE VIEW desktop_launch_failure_events AS
(
SELECT ev.EventID, ev.Time, ed1.StrValue, ed2.StrValue
FROM dbo.VE_event_historical AS ev,
dbo.VE_event_data_historical AS ed1,
dbo.VE_event_data_historical AS ed2
WHERE ev.EventID = ed1.EventID AND ev.EventID = ed2.EventID AND
ev.EventType = ‘BROKER_POOL_EMPTY’ AND
ed1.Name = ‘UserDisplayName’ AND ed2.Name = ‘DesktopId’
);
The following query lists all recent events where an administrator removed a desktop pool.
CREATE VIEW desktop_pool_removed_events AS
(
SELECT ev.EventID, ev.Time, ed1.StrValue, ed2.StrValue
FROM dbo.VE_event_historical AS ev,
dbo.VE_event_data_historical AS ed1,
dbo.VE_event_data_historical AS ed2
WHERE ev.EventID = ed1.EventID AND ev.EventID = ed2.EventID AND
ev.EventType = ‘ADMIN_DESKTOP_REMOVED’ AND
ed1.Name = ‘UserDisplayName’ AND ed2.Name = ‘DesktopId’
);
The following query lists all recent events where an administrator added a ThinApp repository.
CREATE VIEW thinapp_repository_added_events AS
(
SELECT ev.EventID, ev.Time, ed1.StrValue, ed2.StrValue, ed3.StrValue
FROM dbo.VE_event_historical AS ev,
dbo.VE_event_data_historical AS ed1,
dbo.VE_event_data_historical AS ed2,
dbo.VE_event_data_historical AS ed3
WHERE ev.EventID = ed1.EventID AND ev.EventID = ed2.EventID AND ev.EventID = ed3.EventID
AND
ev.EventType = ‘ADMIN_THINAPP_REPO_ADDED’ AND
ed1.Name = ‘UserDisplayName’ AND ed2.Name = ‘ThinAppRepositoryName’ AND
ed3.Name = ‘ThinAppRepositoryPath’
);
26 VMware, Inc.
Using View PowerCLI3
View PowerCLI provides an easy-to-use PowerShell interface to View. You can use View PowerCLI cmdlets
to perform various administration tasks on View components.
This chapter includes the following topics:
“Getting Started with View PowerCLI,” on page 27
n
“View Administrator, PowerCLI Cmdlets, and View Command-Line Interfaces Compared,” on
n
page 30
“View PowerCLI cmdlet Reference,” on page 34
n
“View PowerCLI cmdlet Parameters,” on page 36
n
“Examples of Using View PowerCLI cmdlets,” on page 40
n
“Examples of Using View PowerCLI to Perform Advanced Tasks,” on page 46
n
“Assigning Multiple Network Labels to a Desktop Pool,” on page 52
n
Getting Started with View PowerCLI
PowerShell is a command line and scripting environment designed for Microsoft Windows. PowerShell uses
the .NET object model and provides administrators with management and automation capabilities. You
work with PowerShell by running commands, which are called cmdlets in PowerShell. The command line
syntax for View PowerCLI cmdlets is the same as generic PowerShell syntax.
VMware, Inc.
The View PowerCLI cmdlets are defined in the PowershellServiceCmdlets.dll file, which is installed in the
C:\Program Files\VMware\VMware View\Server\bin directory. The PowershellServiceCmdlets.dll file
constitutes the VMware.View.Broker snapin.
You can edit and extend the View PowerCLI cmdlets script configuration file, InitViewCmdlets.ps1, to
define cmdlet aliases, configure the environment, and set startup actions. InitViewCmdlets.ps1 is in the
Extras folder in the View installation directory.
You can use View PowerCLI cmdlets in conjunction with vSphere PowerCLI cmdlets. vSphere PowerCLI
cmdlets provide an administrative interface to VMware vSphere. If vSphere PowerCLI is installed on a View
Connection Server instance, the vSphere PowerCLI cmdlets load when you launch View PowerCLI.
You can refer to virtual machines and vCenter Server instances by ID in View PowerCLI, but you cannot
pass these entities as objects. For other vSphere objects, such as resource pools and folders, you must
provide a full path. You can use View PowerCLI cmdlets to examine the configuration of vCenter Server
instances within View.
For general information about using PowerShell, see the Microsoft documentation.
27
View Integration
Start the PowerShell Console with View PowerCLI Loaded
You can run the View PowerCLI cmdlets directly on a View Connection Server host.
Prerequisites
Verify that the View Connection Server host has the following software installed.
View 4.5 or later
n
Microsoft .NET framework
n
Windows PowerShell 1.0
n
Procedure
1Log in to the View Connection Server instance as a user in a role that has sufficient privileges to modify
configuration data.
For example, the Administrators role can modify configuration data. A read-only role cannot update
configuration data.
2Select Start > All Programs > VMware > View PowerCLI.
What to do next
If you receive an error message that states the script configuration file cannot be loaded because the
execution of scripts is disabled, type the PowerShell Set-ExecutionPolicy Unrestricted command and
restart the PowerShell console.
Use View PowerCLI cmdlets from a Remote System
You can use the PowerShell remoting feature to access View PowerCLI cmdlets from a remote system.
Procedure
1On the remote system, open the C:\Windows\System32\WindowsPowerShells\v1.0\Profile.ps1 file in a
text editor.
2Add the line add-pssnapin vm* to the Profile.ps1 file.
3Save your changes.
The View PowerCLI snapin to the PowerShell profile is added on the remote system.
What to do next
Take the same precautions for protecting the View PowerCLI operations as you would for other remoting
PowerShell operations.
Display Help for View PowerCLI
You can display help for View PowerCLI by typing commands in the PowerShell console.
Procedure
1On a View Connection Server instance, select Start > All Programs > VMware > View PowerCLI.
28 VMware, Inc.
Chapter 3 Using View PowerCLI
2Display the View PowerCLI help.
OptionAction
List all View PowerCLI cmdlets
Display help for a specific cmdlet
Display detailed help for a specific
cmdlet
Run the Get-Command cmdlet.
For example: Get-Command -PSSnapin VMware.View.Broker | more
Type Get-Help followed by the name of the cmdlet.
For example: Get-Help Add-ViewVC | more
Type Get-Help followed by the name of the cmdlet and the -full
parameter.
For example: Get-Help Add-ViewVC -full | more
Alternatively, use the help alias for Get-Help.
For example: Add-ViewVC -full | more
Examining View PowerCLI cmdlet Errors
View PowerCLI cmdlets handle all errors as non-terminating errors that halt the execution of a cmdlet but
do not terminate a pipeline. You can examine the $error automatic variable to determine the cause of an
error.
To control how PowerShell handles non-terminating errors and how it displays errors in the shell, set the
standard PowerShell $ErrorActionPreference and $errorView automatic variables.
Piping and Specifying Objects of the Same Type
If you attempt to pipe an object into a cmdlet and specify an object of the same type to that cmdlet, the
cmdlet fails with the following error.
The input object cannot be bound to any parameters for the command either because the command
does not take pipeline input or the input and its properties do not match any of the parameters
that take pipeline input.
For example, the following cmdlet usage produces this error.
If you specify a path to a vCenter Server folder that includes certain special characters in the name of an
entity, you must escape the special characters.
Table 3‑1. Escape Sequences for Special Characters
Special CharacterEscape Sequence
%%25
/%2f
\%5c
Do not escape the slashes in the path name itself. For example, represent the path to the
folder /datacenter_01/vm/img%-12 as /datacenter_01/vm/img%25-12.
Certain cmdlets and parameters require escape sequences in entity names.
VMware, Inc. 29
View Integration
Table 3‑2. cmdlet Parameters that Require Escape Sequences
View Administrator, PowerCLI Cmdlets, and View Command-Line
Interfaces Compared
You can use View Administrator, View PowerCLI cmdlets, vdmadmin, vdmutil, and lmvutil to perform
administrative operations on View objects. Not all administrative operations are available in all interfaces.
Table 3‑3. View Administrator, PowerCLI, and View Command-Line Interface Operations
View
ObjectOperation
Application poolAddX
DeleteX
UpdateX
Entitle userX
Remove entitlementX
Cloud Pod ArchitectureView Cloud Pod Architecture
configuration
View pod federation healthX
List global entitlementsXX
List pools in a global entitlement
(desktop or application)
List users or groups in a global
entitlement
List the effective home site for a
user
List dedicated desktop pool
assignments
List pods or sites in a Cloud Pod
Architecture topology
View desktop and application
sessions in the pod federation
You can use View PowerCLI cmdlets to administer View on a View Connection Server instance.
The following table lists all the available View PowerCLI cmdlets, organized by View object. For cmdlet
syntax, use the Get-Help cmdlet. For more information, see “Display Help for View PowerCLI,” on page 28.
Table 3‑4. View PowerCLI cmdlets
ObjectcmdletDescription
Desktop pool
Linked-clone desktop pool
Get-Pool
Remove-Pool
Add-PoolEntitlement
Get-PoolEntitlement
Remove-PoolEntitlement
Add-AutomaticLinkedClonePool
Update-AutomaticLinkedClonePool
Send-LinkedCloneRebalance
Send-LinkedCloneRecompose
Returns information about desktop pools.
Removes a desktop pool.
Creates desktop pool entitlements for users.
Returns information about the users who are
entitled to use desktop pools.
Removes desktop pool entitlement from
users.
Adds an automatically provisioned linkedclone desktop pool.
Updates an automatically provisioned linkedclone desktop pool.
Rebalances linked-clone desktops among the
available logical drives.
Recomposes linked-clone desktops from a
snapshot of their parent virtual machine.
34 VMware, Inc.
Table 3‑4. View PowerCLI cmdlets (Continued)
ObjectcmdletDescription
Refreshes the operating system disks of
linked-clone desktops to their original state
and size.
Lists the shared network labels on all the
hosts in a specified cluster on which a linkedclone desktop pool is to be deployed. The
output is exported to a configuration file.
Lists the shared network labels on all the
hosts in a specified cluster on which a fullclone desktop pool is to be deployed. The
output is exported to a configuration file.
Adds an automatically provisioned full
virtual machine desktop pool.
Updates an automatically provisioned full
virtual machine desktop pool.
Adds a manually provisioned pool of
managed desktops.
Updates a manually provisioned pool of
managed desktops.
Adds a manually provisioned pool of
unmanaged desktops.
Updates a manually provisioned pool of
unmanaged desktops.
Returns information about View Composer.
Returns information about View Connection
Server and security server instances.
Updates the configuration of a View
Connection Server or security server instance.
Returns the View licenses on a View
Connection Server instance.
Sets a View license on a View Connection
Server instance.
Returns a list of physical machines that are
available for use with unmanaged desktop
pools.
Returns information about virtual machines.
Resets a virtual machine.
Returns an event report for a specified view.
Returns the views that are available for use
with the Get-EventReport cmdlet.
Returns global configuration information
about the View environment.
Updates global configuration information
about the View environment.
Returns a list of health monitors for View
services.
Returns information about persistent user
data disks.
Full-clone desktop pool
Automatic virtual machine
desktop pool
Manual desktop pool
View Composer domain
View Connection Server
instance
VMware Horizon license
Physical machine
Virtual machine
Event
View global setting
View service health
monitor
Persistent user data disk
Send-LinkedCloneRefresh
ExportNetworkLabelSpecForLinkedClone
ExportNetworkLabelSpecForFullClone
Add-AutomaticPool
Update-AutomaticPool
Add-ManualPool
Update-ManualPool
Add-ManualUnmanagedPool
Update-ManualUnmanagedPool
Get-ComposerDomain
Get-ConnectionBroker
Update-ConnectionBroker
Get-License
Set-License
Get-DesktopPhysicalMachine
Get-DesktopVM
Send-VMReset
Get-EventReport
Get-EventReportList
Get-GlobalSetting
Update-GlobalSetting
Get-Monitor
Get-ProfileDisk
Chapter 3 Using View PowerCLI
VMware, Inc. 35
View Integration
Table 3‑4. View PowerCLI cmdlets (Continued)
ObjectcmdletDescription
Remote session
User
vCenter Server instance
Get-RemoteSession
Send-SessionDisconnect
Send-SessionLogoff
Get-User
Remove-UserOwnership
Update-UserOwnership
Add-ViewVC
Get-ViewVC
Remove-ViewVC
Update-ViewVC
Returns information about active remote
sessions.
Disconnects an active remote session.
Logs out an active remote session.
Returns information about users.
Removes the ownership of a virtual machine.
Assigns a user (specified as a SID) to a virtual
machine. This cmdlet does not support the
assignment of users to physical machines.
Adds a vCenter Server instance to View.
Returns information about vCenter Server
instances.
Removes a vCenter Server instance from
View.
Updates the configuration of a vCenter Server
instance in View.
View PowerCLI cmdlet Parameters
Some View PowerCLI cmdlet parameters accept settings. For example, the -flashQuality parameter accepts
settings that specify the maximum allowable quality for Adobe Flash content.
Default Display Protocol Parameter
The -defaultProtocol parameter specifies the default display protocol for a desktop pool.
Table 3‑5. -defaultProtocol Parameter Settings
SettingDescription
PCOIPSet the default display protocol to PCoIP.
RDPSet the default display protocol to Microsoft RDP.
Deletion Policy Parameter
The -deletePolicy parameter specifies the deletion policy for automatically provisioned floating and
linked-clone desktop pools.
Table 3‑6. -deletePolicy Parameter Settings
SettingDescription
DefaultDo not delete the machine when the user logs out.
DeleteOnUseDelete the machine when the user logs out.
RefreshOnUseRefresh the machine when the user logs out.
NOTE This setting applies only to linked clone desktop pools.
36 VMware, Inc.
Chapter 3 Using View PowerCLI
Flash Quality Parameter
The -flashQuality parameter specifies the maximum allowable quality for Adobe Flash content. This value
overrides the setting on a Web page. If the Adobe Flash quality for a Web page is higher than the maximum
value allowed, the client reduces the quality to the specified maximum. Lowering the quality of Adobe
Flash content causes the content to use less bandwidth.
Table 3‑7. -flashQuality Parameter Settings
SettingDescription
HIGHAllow low, medium, or high quality Flash content.
LOWAllow only low quality Flash content.
MEDIUMAllow low or medium quality Flash content.
NO_CONTROLAllow the Web page settings to determine the quality of Flash content.
Flash Throttling Parameter
The -flashThrottling parameter specifies how often Adobe Flash refreshes onscreen information.
Throttling Adobe Flash to increase the refresh interval reduces the frame rate. This reduction causes Adobe
Flash content to use less bandwidth, but it might also cause Adobe Flash to drop frames.
Table 3‑8. -flashThrottling Parameter Settings
SettingDescription
AGGRESSIVESet the refresh interval to 2500 milliseconds. This setting produces the
highest number of dropped frames. The speed of audio transmission is
unaffected.
CONSERVATIVESet the refresh interval to 100 milliseconds. This setting produces the
lowest number of dropped frames. The speed of audio transmission is
unaffected.
DISABLEDDisable throttling. The timer interval is not modified.
MODERATESet the refresh interval to 500 milliseconds. The speed of audio
transmission is unaffected.
LDAP Backup Frequency Parameter
The -ldapBackupFrequency parameter specifies the LDAP backup frequency for a View Connection Server
instance.
Every12HourBack up the LDAP database once every 12 hours.
Every2DayBack up the LDAP database once every two days.
Every2WeekBack up the LDAP database once every two weeks.
Every6HourBack up the LDAP database once every six hours.
EveryDayBack up the LDAP database once per day.
EveryHourBack up the LDAP database once per hour.
EveryWeekBack up the LDAP database once per week.
NeverTurn off backup for the LDAP database.
VMware, Inc. 37
View Integration
Pool Type Parameter
The -poolType parameter specifies the desktop pool type.
Table 3‑10. -poolType Parameter Settings
SettingDescription
IndividualUnmanagedThe pool contains an individual unmanaged machine.
IndividualVCThe pool contains an individual machine that is managed and
ManualThe pool contains manually configured floating (nonpersistent)
ManualUnmanagedNonPersistentThe pool contains manually configured floating (nonpersistent)
ManualUnmanagedPersistentThe pool contains manually configured dedicated (persistent) machines
ManualVCPersistentThe pool contains manually configured dedicated (persistent) machines
NonPersistent(AutomaticPool) The pool contains automatically configured floating
OnRequestSviNonPersistent(AutomaticPool) The pool contains floating (nonpersistent) machines
OnRequestSviPersistent(AutomaticPool) The pool contains dedicated (persistent) machines that
OnRequestVcNonPersistent(AutomaticPool) The pool contains floating (nonpersistent) machines
OnRequestVcPersistent(AutomaticPool) The pool contains dedicated (persistent) machines that
Persistent(AutomaticPool) The pool contains automatically configured dedicated
SVINonPersistent(AutomaticPool) The pool contains floating (nonpersistent) machines
SVIPersistent(AutomaticPool) The pool contains dedicated (persistent) machines that
configured by a vCenter Server instance.
machines that are managed and configured by a vCenter Server
instance.
machines that are not managed by a vCenter Server instance.
that are not managed by a vCenter Server instance.
that are managed by a vCenter Server instance.
(nonpersistent) machines that are provisioned, managed, and
configured by a vCenter Server instance.
that are provisioned, managed, and configured by a vCenter Server
instance and View Composer when requested.
are provisioned, managed, and configured by a vCenter Server instance
and View Composer when requested.
that are provisioned, managed, and configured by a vCenter Server
instance when requested.
are provisioned, managed, and configured by a vCenter Server instance
when requested.
(persistent) machines that are provisioned, managed, and configured by
a vCenter Server instance.
that are provisioned, managed, and configured by a vCenter Server
instance and View Composer.
are provisioned, managed, and configured by a vCenter Server instance
and View Composer.
Power Policy Parameter
The -powerPolicy parameter specifies the power policy for a desktop pool.
38 VMware, Inc.
Chapter 3 Using View PowerCLI
Table 3‑11. -powerPolicy Settings
SettingDescription
AlwaysOnConfigure the machine to remain powered on, even when no one is
using it. If you shut down the machine, the machine restarts
immediately.
RemainOnStart the machine when required if the machine is powered down. The
machine remains powered on until you shut it down.
PowerOffShut down the machine when no one is using it.
SuspendSuspend the machine when no one is using it.
Refresh Policy Type Parameter
The -refreshPolicyType parameter specifies the refresh policy for the OS disks of automatically provisioned
dedicated and linked clone desktop pools.
Table 3‑12. -refreshPolicyType Settings
SettingDescription
AlwaysRefresh the OS disk whenever the user logs off.
ConditionalRefresh the OS disk when the user logs off, but only if certain
conditions are met. Use the -refreshpolicyDays and refreshPolicyUsage parameters to specify the refresh interval in days
and the percentage of the maximum allowable size for the disk.
NeverNever refresh the OS disk when the user logs off.
Smart Card Setting Parameter
The -smartCardSetting parameter specifies the smart card authentication policy setting. This setting applies
to Update-ConnectionBroker, and does not have any effect unless you also specify -UseSSLClient $true with
Update-GlobalSetting.
Table 3‑13. -smartCardSetting Parameter Settings
SettingDescription
NotAllowedDisable smart card authentication.
OptionalAllow users to use smart card authentication or password
authentication to connect to the View Connection Server instance. If
smart card authentication fails, the user must provide a password.
RequiredRequire users to use smart card authentication when they connect to the
View Connection Server instance. Smart card authentication replaces
only Windows password authentication. If SecureID is enabled, users
are required to authenticate by using both SecureID and smart card
authentication.
View Composer Task Parameter
The -composerTask parameter specifies a View Composer maintenance task on a virtual machine.
Get-Pool -displayName "My Pool 1" | Remove-Pool DeleteFromDisk $true
Chapter 3 Using View PowerCLI
Creating and Updating Automatically Provisioned Desktop Pools
You can use the Get-ViewVC and Update-AutomaticPool cmdlets to create and update automatically
provisioned desktop pools.
In the following example, the Get-ViewVC cmdlet adds an automatically provisioned desktop pool called
auto1. The desktop pool is managed by a vCenter Server instance called vc.mydom.int.
Because the datastores specified in the -datastorePaths parameter override the previous setting, you must
specify any existing datastores in the parameter for the desktop pool to continue to use those datastores.
Creating and Updating Linked-Clone Desktop Pools
You can use the Get-ViewVC and Get-DesktopVM cmdlets to create and update linked-clone desktop pools.
In the following example, the Get-ViewVC cmdlet adds a linked-cloned desktop pool named lcdpool_1. The
pool is managed by View Composer on a vCenter Server instanced named vc.mydom.int.
You can provision all the desktops in advance by setting the -minimumCount and -maximumCount parameters
to the same value. If you specify a persistent data disk, use an uppercase letter for the drive. Do not use a
letter that already exists on the parent virtual machine for a drive such as A, B, or C, or a letter that conflicts
with a network-mounted drive.
In the following example, the Get-ViewVC cmdlet updates the configuration of a linked-clone desktop pool
named lcdpool_1.
Because the datastores specified in the -datastoreSpecs parameter override the previous setting, you must
specify any existing datastores in the parameter for the pool to continue to use those datastores.
You can use the Get-DesktopVM cmdlet to perform rebalance, refresh, and recompose operations.
Table 3‑18. Examples of Rebalance, Refresh and Recompose Operations
TaskExample View PowerCLI cmdlet Syntax
Rebalance desktops among the available
datastores in a linked-clone desktop pool
Refresh the operating system disk in each
linked-clone desktop by restoring its original
state and size
Recompose all linked-clone desktops from a
snapshot of the parent virtual machine
Creating and Updating Manually Provisioned Desktop Pools
You can use the Add-ManualPool, Get-ViewVC, and Update-ManualPool cmdlets to create and update manually
provisioned desktop pools.
In the following example, the Add-ManualPool cmdlet creates a manually provisioned desktop pool named
manPool that contains a virtual machine named myVM.
In the following example, the Get-ViewVC cmdlet creates a manually provisioned desktop pool named man1
from the desktops managed by the vCenter Server instance named vc.mydom.int.
NOTE To use the Get-VM cmdlet, you must install vSphere PowerCLI.
Creating and Updating Manual Unmanaged Desktop Pools
You can use the Add-ManualUnmanagedPool and Update-ManualUnmanagedPool cmdlets to create and update
manual unmanaged desktop pools.
In the following example, the Add-ManualUnmanagedPool cmdlet creates an unmanaged desktop pool named
unman1 that contains physical machines named pm01 and pm02.
You can use the Get-User cmdlet to display information about Active Directory users and groups.
In the following example, the Get-User cmdlet displays information about all the users in a domain named
mydom.
Get-User -domain "mydom"
In the following example, the Get-User cmdlet displays information about a user named fred in the domain
named mydom. It excludes information about the user's group.
You can use View PowerCLI cmdlets to display and update global settings for View.
Table 3‑23. Examples of Common Global Settings Management Tasks
TaskExample View PowerCLI cmdlet Syntax
Display the global settings
Update the session timeout setting
Update the forced logout warning message
and delay period
Require clients to use SSL to connect and set
the prelogin message
Get-GlobalSetting
Update-GlobalSetting -SessionTimeout 1800
Update-GlobalSetting -DisplayLogoffWarning $true ForcedLogoffAfter $logoutdelay -ForcedLogoffMessage "Forced
log out will occur in $logoutdelay minutes"
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.
46 VMware, Inc.
Chapter 3 Using View PowerCLI
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?"
}
}
Resizing Automatic and Linked-Clone Pools
The following PowerShell functions determine the current usage of all desktop pools and resize any
automatically provisioned or linked-clone desktop pools that are at maximum capacity.
# PollAllPoolsUsage
# Parameters
# $increment Amount by which to increase a pool that is at maximum capacity (default = 5).
function PollAllPoolsUsage
{ param ($increment)
if(-not $increment){
$increment = 5
}
VMware, Inc. 47
View Integration
# Retrieve all pool objects and check each one individually
$pools = Get-Pool
foreach ($pool in $pools){
PollPoolUsage $pool $increment
}
}
# PollPoolUsage
# Parameters
# $Pool Pool object that represents the pool to be checked.
# $increment Amount by which to increase pool that is at maximum capacity.
function PollPoolUsage
{ param ($Pool, $increment)
# Get a list of remote sessions for the pool (errors are suppressed)
$remotes = Get-RemoteSession -pool_id $Pool.pool_id -ErrorAction SilentlyContinue
# Count the remote sessions.
$remotecount = 0
if($remotes){
$remotecount = ([Object[]]($remotes)).Count
}
# Determine the maximum number of desktops configured for a pool.
$maxdesktops = 0
if($Pool.deliveryModel -eq "Provisioned"){
$maxdesktops = $Pool.maximumCount
} else {
$maxdesktops = $Pool.machineDNs.split(";").Count
}
# Output the usage statistics for a pool.
Write-Output ("==== " + $Pool.pool_id + " ====")
Write-Output ("Remote session count: " + $remotecount)
Write-Output ("Maximum desktops: " + $maxdesktops)
# If a pool is using all its desktops, increase its maximum size
# or output a warning if it cannot be resized.
if($maxdesktops -eq $remotecount){
if($Pool.deliveryModel -eq "Provisioned"){ # Pool type can be resized
$newmaximum = [int]$Pool.maximumCount + [int]$increment
if($Pool.desktopSource -eq "VC"){ # Resize an automatic pool
Update-AutomaticPool -pool_id $Pool.pool_id -maximumCount $newmaximum
} elseif ($Pool.desktopSource -eq "SVI"){ # Resize a linked-clone pool
Update-AutomaticLinkedClonePool -pool_id $Pool.pool_id -maximumCount $newmaximum
}
Write-Output ("Pool " + $Pool.pool_id + " is using 100% of its desktops. Maximum VMs
increased to " + $newmaximum)
} else { # Pool type cannot be resized
Write-Output ("Pool " + $Pool.pool_id + " is using 100% of its desktops. Consider
increasing its capacity.")
}
}
}
48 VMware, Inc.
Chapter 3 Using View PowerCLI
Determining Paths to vSphere Inventory Objects
The following PowerShell function uses vSphere PowerCLI to return the full path to a vSphere inventory
object.
$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
}
}
VMware, Inc. 49
View Integration
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
}
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)
$PoolSettings = (Get-Pool -pool_id $Pool)
$datastores = $PoolSettings.datastorePaths + ";$Datastore"
Update-AutomaticPool -pool_id $Pool -datastorePaths $datastores
}
Define a PowerShell function to remove a datastore from an automatic pool.
# RemoveDatastoreFromAutomaticPool
# Parameters
# $Pool Pool ID of pool to be updated.
# $Datastore Full path to datastore to be removed.
Assigning Multiple Network Labels to a Desktop Pool
In View 5.2 and later releases, you can configure automated full-clone and linked-clone desktop pools to use
multiple network labels. This feature expands the number of IP addresses you can assign to the virtual
machines in a pool, making it easier to create pools that have a large number of desktops. You can use View
PowerCLI cmdlets to assign network labels that are available in the vCenter Server resource pool where the
automated full-clone or linked-clone desktop pool is deployed.
By default, the virtual machines in a desktop pool inherit the network interface card (NIC) and its associated
network label from the parent virtual machine or template. Some parent virtual machines or templates
might have multiple NICs and associated network labels. Typically, the subnet mask of a VLAN defined by
a network label has a limited range of available IP addresses. For example, a subnet mask might have a
maximum of 254 IP addresses that can be assigned to the desktop virtual machines.
View distributes network labels among the virtual machines in the entire desktop pool. When View
provisions desktops, it assigns network labels in alphabetical order. When the maximum number of virtual
machines are provisioned with IP addresses that use the first network label, View starts to assign the second
label, and so on.
To configure a desktop pool to use multiple network labels, you select network labels from the labels
defined for the ESXi cluster in vCenter Server, associate the labels with the NICs that are inherited from a
parent virtual machine or template, specify the maximum number of IP addresses that can be assigned to
virtual machines from each network label, and save the information in a network label configuration file.
You specify the network label configuration file in the View PowerCLI cmdlet that you use to create the
desktop pool.
Network Label Configuration File Format
You use a network label configuration file to configure automated full-clone and linked-clone desktop pools
to use multiple network labels. The network label configuration file contains a flag that controls whether
network labels are assigned and sections that define NICs, network labels, and network label attributes.
Enabled Flag
This flag is set to enabled=true by default. Keep the flag set to true to allow View to assign network labels to
the pool.
Parameter Definition for NIC Section
This section lists the NICs defined in vCenter Server on the template or snapshot of the parent virtual
machine. Do not edit this section.
Parameter Definition for Network Section
This section lists the network labels defined in vCenter Server instance for the ESXi hosts in the cluster.
Network labels are listed in alphabetical order. If a cluster uses standard network labels and distributed
virtual switch network labels, use only one type of label for a pool. Do not edit this section.
Network Label Attribute Definition Section
This section lists the network labels associated with each NIC. The network labels are commented out and
the assignments are not functional. You must remove the comments (### marks) from the appropriate
network labels to allow them to be assigned to a desktop pool.
The maxvm parameter defines the maximum number of IP assignments that can be made to virtual machines
from the network label. The value of the maxvm parameter is generated by the -maxVMsPerNetworkLabel
parameter in the Export-NetworkLabelSpecForLinkedClone or Export-NetworkLabelSpecForFullClone
cmdlet. You can manually edit this value in the configuration file.
52 VMware, Inc.
Chapter 3 Using View PowerCLI
As a best practice, do not assign a network label to more than one desktop pool. The maximum network
label counts are honored only on a per-NIC, per-pool basis. For example, if you configure NIC1 on pool1 to
use network06 with a maxvm of 244, and you configure NIC1 on pool2 to use the same network label,
network06, with a maxvm of 244, network06 must have an actual assignable IP address space of at least 488
addresses or the IP assignments from the network label might become oversubscribed.
If the parent virtual machine or template has two NICs, each network label discovered by the Export-
NetworkLabelSpecForLinkedClone or Export-NetworkLabelSpecForFullClone cmdlet is associated with both
NICs. Warning messages explain that IP address assignments can become oversubscribed because the
assignment function for one NIC is not aware of the assignments that are made from the same network label
for the second NIC. Each NIC is aware only of its own network label assignments.
Example Network Label Configuration File
The following example shows a typical network label configuration file.
#Network Label Configuration Spec
#WARNING! Setting enabled flag to false will
#turn off the automatic network label assignment
#for newly provisioned desktops.
enabled=true
#Parameter Definition for NIC
nic1=Network adapter 1
nic2=Network adapter 2
#Network Label Attribute Definition
#Expected format:
#<nic_param>.<network_param>.maxvm=<max vm for network label>
#WARNING! Multiple NICs:(nic1,nic2) detected against network01,
#total port count against network01: 488.
#IP address might be over-subscribed.
#WARNING! Multiple NICs:(nic1,nic2) detected against network02,
#total port count against network02: 488.
#IP address might be over-subscribed.
...
...
#WARNING! Multiple NICs:(nic1,nic2) detected against network02,
#total port count against network10: 488.
#IP address might be over-subscribed.
Obtain and Export NIC and Network Label Information
Before you can assign multiple network labels to a pool, you must obtain NIC and network label
information and export that information to a network label configuration file.
For a full-clone pool, you obtain information about the NICs configured on the template that you use to
create the full-clone pool. For a linked-clone pool, you obtain information about the NICs configured on the
parent virtual machine that you use to create the linked-clone pool. You obtain network label information
from the available network labels configured on the ESXi hosts in the cluster on which the desktop pool is to
be deployed.
When you export the NIC and network label information to a network label configuration file, you set the
maximum number of virtual machines that can be provisioned with IP addresses from each network label.
You should allow a certain number of virtual machines for overhead. For example, if a network label VLAN
allows a maximum of 254 IP addresses to be assigned to virtual machines, you might set the maximum
number to 244.
Prerequisites
Become familiar with using View PowerCLI. See “Getting Started with View PowerCLI,” on page 27.
Procedure
To obtain and export NIC and network label information to create a full-clone pool, use the Export-
n
NetworkLabelSpecForFullClone cmdlet.
For example:
Export-NetworkLabelSpecForFullClone -vc_id id -clusterPath "cluster-path"
-TemplatePath "template-path" -maxVMsPerNetworkLabel nn
-networkLabelConfigFile "config-file-path"
To obtain and export NIC and network label information to create a linked-clone pool, use the Export-
n
NetworkLabelSpecForLinkedClone cmdlet.
For example:
Export-NetworkLabelSpecForLinkedClone -vc_id id -clusterPath "cluster-path"
-maxVMsPerNetworkLabel nn -networkLabelConfigFile "config-file-path"
54 VMware, Inc.
Chapter 3 Using View PowerCLI
The network label cmdlet obtains the network labels configured in vCenter Server for all the ESXi hosts in
the specified cluster, sets the maximum number of virtual machines that can be provisioned with IP
addresses from each network label, and exports the list of NICs and network labels to the network label
configuration file.
Example: Obtaining NIC and Network Label Information
In this example, the Export-NetworkLabelSpecForLinkedClone cmdlet obtains NICs from the Win7-Parent
virtual machine and Snapshot1, and network label information from Cluster1. A maximum of 244 virtual
machines can be provisioned with IP addresses from each network label. The information is exported to a
network label configuration file named C:/label.txt.
Verify and edit the network label configuration file. See “Verify and Edit a Network Label Configuration
File,” on page 55.
Verify and Edit a Network Label Configuration File
After you generate a network label configuration file, you must verify its contents and edit it to specify the
NIC and network label pairings to assign to the pool.
Prerequisites
Generate a network label configuration file. See “Obtain and Export NIC and Network Label
n
Information,” on page 54.
Become familiar with the network label configuration file format. See “Network Label Configuration
n
File Format,” on page 52.
Procedure
1In a text editor, open the network label configuration file.
2For each NIC and network label pairing that you want to assign to the pool, remove the comments (###
marks).
3Verify that each network label is assigned to only one NIC.
4Verify that only one type of network label is used for the pool.
A NIC can be configured with a standard network switch or distributed virtual network switch.
5Save your changes.
Example: Edited Network Label Configuration File
In this example, network06 and network07 are assigned to nic1 (Network adapter 1) and network08 and
network09 are assigned to nic2 (Network adapter 2). network01 through network05 remain commented and
are not used. This configuration can support a pool of up to 488 virtual machines.
#Network Label Configuration Spec
...
#Network Label Attribute Definition
#Expected format:
#<nic_param>.<network_param>.maxvm=<max vm for network label>
Create a desktop pool that can use the multiple network labels. See “Deploy a Desktop Pool That Uses
Multiple Network Labels,” on page 56.
Deploy a Desktop Pool That Uses Multiple Network Labels
You can use View PowerCLI cmdlets to deploy an automated full-clone or linked-clone desktop pool that
uses multiple network labels.
Prerequisites
Generate a network label configuration file. See “Obtain and Export NIC and Network Label
n
Information,” on page 54.
Verify and edit the network label configuration file. See “Verify and Edit a Network Label
n
Configuration File,” on page 55.
Procedure
Use a View PowerCLI cmdlet to deploy the desktop pool.
u
OptionAction
Deploy a linked-clone pool
Deploy a full-clone desktop pool
Run the Add-AutomaticLinkedClonePool cmdlet and specify the path to
the network label configuration file with the -NetworkLabelConfigFile
parameter.
Run the Add-AutomaticPool cmdlet and specify the path to the network
label configuration file with the -NetworkLabelConfigFile parameter.
56 VMware, Inc.
Chapter 3 Using View PowerCLI
Example: Linked-Clone Desktop Pool Deployment
In this example, the Add-AutomaticLinkedClonePool cmdlet creates a linked-clone pool named
POOL_NAME and assigns the network labels in the network label configuration file named label.txt file.
As View provisions virtual machines in a pool, it assigns network labels to the NICs in the virtual machines.
When the maximum number of virtual machines to be assigned a certain network label is reached, View
begins provisioning from the next network label.
After View assigns a network label to a virtual machine, it does not change the assignment.
If virtual machines in a pool are deleted, the associated network label assignments are freed and can be
assigned to any newly provisioned virtual machines in the pool.
View Composer refresh operations do not affect network label assignments. Virtual machines continue to
receive the network labels that were assigned to them when they were first provisioned.
Preserving Network Labels During Recompose and Rebalance Operations
During View Composer recompose and rebalance operations, View attempts to ensure that the network
label of each NIC attached to each linked-clone desktop is preserved when a linked clone inherits new NICs
from a new base image. View preserves the network label of a NIC that was in place before the recompose
or rebalance operation as long as the new base image has an available NIC configured with the same type of
network switch. You can configure a NIC with a standard network switch or distributed virtual network
switch.
The following examples describe the rules that govern network label preservation during recompose and
rebalance operations.
If both the original linked-clone desktop and the new base image have one NIC configured with a
n
standard network switch, the network label and MAC address are preserved.
If both the original linked-clone desktop and the new base image have one NIC configured with a
n
distributed virtual network switch, the network label and MAC address are preserved.
If the original linked-clone desktop has one NIC configured with a standard network switch and the
n
new base image has one NIC configured with a distributed virtual network switch, the network label is
not preserved. The MAC address is preserved.
If the original linked-clone desktop has two NICs, both of which are configured with a standard
n
network switch, and the new base image has one NIC configured with a standard network switch, the
network label of one original NIC is preserved, but all network properties associated with the other
original NIC are not preserved.
VMware, Inc. 57
View Integration
Displaying Network Label Assignments for a Pool
You can use the Get-Pool cmdlet to display the network label assignments for a pool. The
networkLabelSpecs output parameter shows the network labels that are assigned to the pool. You do not
need to add a parameter in the command line to display this information.
The following table describes the networkLabelSpecs output format.
Table 3‑24. networkLabelSpecs Output Format
ValueDescription
nlNetwork label name.
nicNIC name.
enabledA value of 1 means the label is active. A value of 0 means it is disabled.
maxMaximum number of virtual machines that can be assigned the network label.
usageNumber of virtual machines currently assigned to the network label.
When the usage value equals the max value, View stops assigning that network label
and starts making assignments from the next available label.
The following Get-Pool cmdlet example shows network label assignments for the pool Pool2.
Displaying Network Label Assignments for a Virtual Machine
You can use the Get-DesktopVM cmdlet to display network label assignments for a virtual machine. The
netLabelAutoAssigns output parameter shows the NIC names and network labels that View attempted to
assign to the virtual machine. You do not have to add a parameter in the command line to display this
information.
If the enabled flag in the network label configuration file was set to 0, the netLabelAutoAssigns output
shows this feature is disabled.
The netLabelAutoAssigns output displays the network label assignments that View Connection Server
reserves for the virtual machine. To see the network labels that are assigned to the virtual machine in
vCenter Server, use the -getNetworkLabel parameter with the Get-DesktopVM cmdlet. For more information,
see “Displaying vCenter Server Network Label Assignments for a Virtual Machine,” on page 59.
58 VMware, Inc.
Chapter 3 Using View PowerCLI
The following Get-DesktopVM cmdlet example displays network label assignments for the virtual machine
918 in the pool pool2.
Displaying vCenter Server Network Label Assignments for a Virtual Machine
vCenter Server can make additional network label assignments to virtual machines. These assignments are
outside the control of View.
To see the network labels that are assigned to a virtual machine in vCenter Server, use the -getNetworkLabel
parameter with the Get-DesktopVM cmdlet. You must type a Boolean value of $true in the command line to
enable the -getNetworkLabel parameter. The output of the Get-DesktopVM cmdlet displays the networkLabels
parameter, which shows the NICs and network label assignments that were made for the virtual machine.
The following Get-DesktopVM cmdlet example displays network label assignments made in vCenter Server
for the virtual machine 1849 in the pool pool2.
NOTE Because the -getNetworkLabel parameter is a long-running parameter, run the Get-DesktopVM cmdlet
with the -getNetworkLabel parameter during off-peak periods of vSphere utilization.
Disable Automatic Network Label Assignments
You can disable network label assignments on an existing pool that uses automatic assignments.
Procedure
1In a text editor, open the network label configuration file.
2Set the enabled flag to false.
For example: enabled=false
3Save your changes.
4Run the Update-AutomaticLinkedClonePool or Update-AutomaticPool cmdlet and specify the path to the
updated network label configuration file with the -NetworkLabelConfigFile parameter.
When View provisions new virtual machines in the pool, it uses the network labels on the parent virtual
machine or template.
60 VMware, Inc.
Customizing LDAP Data4
You can use VMware and Microsoft command-line tools to import and export LDAP configuration data to
and from View. These command-line tools import and export LDAP configuration data in LDAP Data
Interchange Format (LDIF) configuration files.
This feature is intended for use by advanced administrators who want to perform automatic bulk
configuration operations. To create scripts to update the View configuration, use View PowerCLI.
This chapter includes the following topics:
“Introduction to LDAP Configuration Data,” on page 61
n
“Modifying LDAP Configuration Data,” on page 62
n
Introduction to LDAP Configuration Data
All View configuration data is stored in an LDAP directory. Each View Connection Server standard or
replica instance contains a local LDAP configuration repository and a replication agreement between each of
the View Connection Server instances. This arrangement ensures that changes to one repository are
automatically replicated to all other repositories.
When you use View Administrator to modify the View configuration, the appropriate LDAP data is
updated in the repository. For example, if you add a desktop pool, View stores information about users,
user groups, and entitlements in LDAP. View Connection Server instances manage other LDAP
configuration data automatically, and they use the information in the repository to control View operations.
VMware, Inc.
You can use LDIF configuration files to perform a number of tasks, including transferring configuration data
between View Connection Server instances and backing up your View configuration so that you can restore
the state of a View Connection Server instance.
You can also use LDIF configuration files to define a large number of View objects, such as desktop pools,
and add those objects to your View Connection Server instances without having to use View Administrator
to perform the task manually.
In View 3.1 and later releases, View performs regular backups of the LDAP repository.
LDAP configuration data is transferred as plain ASCII text and conforms to the Internet Engineering Task
Force (IETF) RFC 2849 standard.
61
View Integration
Modifying LDAP Configuration Data
You can export LDAP configuration data on a View Connection Server instance to an LDIF configuration
file, modify the LDIF configuration file, and import the modified LDIF configuration file into other View
Connection Server instances to perform automatic bulk configuration operations.
You can obtain examples of LDIF syntax for any item of LDAP configuration data in View by examining the
contents of an exported LDIF configuration file. For example, you can extract the data for a desktop pool
and use that data as a template to create a large number of desktop pools.
Export LDAP Configuration Data
You can use the vdmexport command-line utility to export configuration data from a standard or replica
View Connection Server instance to an LDIF configuration file.
By default, the vdmexport command-line utility is installed in the C:\Program Files\VMware\VMware
View\Server\tools\bin directory.
Procedure
1Log in to a standard or replica View Connection server instance.
OptionAction
View 3.1 and earlier
View 4.5 and later
2
At the command prompt, type the vdmexport command and use the -f option to specify the name of the
LDIF configuration file to export.
Log in as an administrator and be a member of the Local Administrators
user group.
Log in as a user in the Administrators or Administrators (Read only) role.
NOTE You must be logged in as a user in the Administrators or
Administrators (Read only) role to export configuration data from the
View configuration repository.
For example: vdmexport -f myexport.LDF
Alternatively, you can redirect the output instead of using the -f option.
For example: vdmexport > myexport.LDF
The vdmexport command writes the configuration of your View Connection Server instance to the file that
you specify. The command displays errors if your role has insufficient privileges to view the data in the
configuration repository.
Defining a Desktop Pool in an LDIF Configuration File
You can define a desktop pool in an LDIF configuration file and import the customized LDIF configuration
file to create a large number of desktop pools.
NOTE You can also create customized LDIF configuration files for other objects that are defined in the
LDAP repository, including global configuration settings, configuration settings for a specific View
Connection Server instance or security server, and configuration settings for a specific user.
To define a desktop pool in an LDIF configuration file, you must add the following entries to the file.
A Virtual Desktop VM entry for each virtual desktop in the desktop pool
n
A VM Pool entry for each desktop pool
n
A Desktop Application entry that defines the entitlement of the desktop pool
n
62 VMware, Inc.
Chapter 4 Customizing LDAP Data
You associate each VM Pool entry with one Desktop Application entry in a one-to-one relationship. A
Desktop Application entry cannot be shared between VM Pool entries, and a VM Pool entry can only be
associated with one Desktop Application entry.
The following table describes the attributes you must specify when you modify a desktop pool definition in
an LDIF configuration file.
Table 4‑1. Important Attributes for Defining a Desktop Pool
EntryAttributeDescription
Virtual Desktop VM
VM Pool
Desktop Application
Desktop ApplicationmemberA list of Active Directory (AD) users and groups who are entitled to
cnCommon name of an entry. If you require names to be generated
automatically, specify globally unique identifier (GUID) strings. You
can use any reliable GUID generator, such as the mechanism provided
by .NET (for example, by calling System.Guid.NewGuid().ToString() in
Visual Basic).
access the desktop pool. The attribute is specified in the form of a
Windows Security Identifier (SID) reference. A member value of
<SID=S-1-2-3-4> represents an AD user or group with the SID value
S-1-2-3-4.
In LDIF format, the left angle (<) character is reserved, so you must
place two colons (::) after the attribute name and specify the SID value
in base 64 format (for example, PFNJRD1TLTEtMi0zLTQ+IA==).
Because this attribute is multivalued, you can use it on multiple lines to
represent each entry in a list of SIDs.
Sample LDIF Configuration File Desktop Pool Entries
The following example is an excerpt from an LDIF configuration file. It shows sample entries for a desktop
pool named Pool1, which contains two virtual desktops named VM1 and VM2. The desktop pool entry is
paired with the Desktop Application entry, which is also named Pool1.
#
# Desktop Application entry Pool1 -- one entry is required for each VM Pool
#
DN: CN=Pool1,OU=Applications,DC=vdi,DC=vmware,DC=int
changetype: add
objectClass: top
objectClass: pae-Entity
objectClass: pae-App
objectClass: pae-WinApp
objectClass: pae-ThinWinApp
objectClass: pae-DesktopApplication
cn: Pool1
member:: PFNJRD1TLTEtMi0zLTQ+IA==
pae-Icon: /thinapp/icons/desktop.gif
pae-URL: \
pae-Servers: CN=Pool1,OU=Server Groups,DC=vdi,DC=vmware,DC=int
pae-ServerProtocolLevel: OSX_NETOP
pae-ServerProtocolLevel: OS2_NETOP
pae-ServerProtocolLevel: NT4_NETOP
pae-ServerProtocolLevel: WIN2K_NETOP
pae-ServerProtocolLevel: NT4_RDP
pae-ServerProtocolLevel: WIN2K_RDP
pae-ServerProtocolLevel: XP_RDP
pae-Disabled: 0
Use the vdmimport Command to Import LDAP Configuration Data
In View 4.5 and later releases, you can use the vdmimport command to import configuration data from an
LDIF configuration file into a standard or replica View Connection Server instance.
By default, the vdmimport command-line utility is installed in the C:\Program Files\VMware\VMware
View\Server\tools\bin directory.
Prerequisites
Verify that you have View 4.5 or later. If you have an earlier View release, see “Use the LDIFDE
n
Command to Import LDAP Configuration Data,” on page 66.
Export LDAP configuration data to an LDIF configuration file. See “Export LDAP Configuration Data,”
n
on page 62.
Procedure
1Log in to a View Connection Server instance as a user in the Administrators role.
You must be logged in as a user in the Administrators role to import configuration data into the View
configuration repository.
VMware, Inc. 65
View Integration
2
At the command prompt, type the vdmimport command and use the -f option to specify the LDIF
configuration file to import.
For example: vdmimport -f myexport.LDF
After the vdmimport command runs, the configuration of your View Connection Server instance is updated
with the data from the file, and the number of records that have been successfully updated is displayed.
Errors are displayed if some records could not be updated because your role has insufficient privileges.
Use the LDIFDE Command to Import LDAP Configuration Data
You can use the Microsoft LDIFDE command to import configuration data from an LDIF configuration file
into a standard or replica View Connection Server instance.
In View releases earlier than View 4.5, you must use the Microsoft LDIFDE command to import configuration
data from an LDIF configuration file. The vdmimport command is not supported in View releases earlier than
View 4.5.
If you have View 4.5 or later, use the vdmimport command rather than the LDIFDE command. The vdmimport
command does not display the large number of error messages that are produced by running the LDIFDE
command. For more information, see “Use the vdmimport Command to Import LDAP Configuration Data,”
on page 65.
Because the LDIFDE command does not update, create, or delete any LDAP records that are not defined in
the LDIF configuration file, it enables you to customize an LDIF configuration file so that only selected
records are affected when you import the file. For complete information about using the LDIFDE command,
go to http://support.microsoft.com/kb/237677.
Prerequisites
Export LDAP configuration data to an LDIF configuration file. See “Export LDAP Configuration Data,” on
page 62.
Procedure
1Log in to a View Connection server instance.
OptionAction
View 3.1 or earlier
View 4.5 or later
Log in as an administrator and be a member of the Local Administrators
user group.
Log in as a user in the Administrators role.
NOTE You must be logged in as a user in the Administrators role to
import configuration data into the View configuration repository.
2
At the command prompt, type the LDIFDE command and use the -f option to specify an existing LDIF
configuration file.
For example: LDIFDE -i -f myexport.LDF -s 127.0.0.1 -z
After the LDIFDE command runs, the configuration of your View Connection Server instance is updated with
the data from the file, and the number of records that are successfully updated is displayed.
Error messages appear whenever an existing entry in the repository is overwritten. You can ignore these
error messages. Error messages also appear if a record cannot be updated because your role has insufficient
privileges.
66 VMware, Inc.
Integrating View with Microsoft
SCOM5
You can use Microsoft System Center Operations Manager (SCOM) to monitor the state of View
components, including View Connection Server instances, security servers, and the View services that run
on View Connection Server and security server hosts.
This chapter includes the following topics:
“Setting Up a SCOM Integration,” on page 67
n
“Monitoring View in the Operations Manager Console,” on page 72
n
Setting Up a SCOM Integration
Integrating View with SCOM involves assigning a name to the View Connection Server group, importing
the View management packs on the SCOM server, enabling a proxy agent on each View Connection Server
instance and security server, and running the View discovery script in the Operations Manager console.
Assign a Name to the View Connection Server Group
Before you can use SCOM to monitor and manage the state of View components, you must assign a name to
the View Connection Server group in View. The Operations Manager console displays this name to help you
identify the View Connection Server group within SCOM.
VMware, Inc.
NOTE View Administrator does not display the View Connection Server group name.
Prerequisites
Become familiar with the vdmadmin command-line interface. For more information, see the View
Administration document.
Procedure
1Log in to one of the View Connection Server hosts in the View Connection Server group.
2
At the command prompt, type the vdmadmin command with the -C and -c options.
For example: vdmadmin -C -c group_name
The -c option specifies the name to assign to the View Connection Server group.
Example: Assigning a View Connection Server Group Name
In this example, the vdmadmin command sets the name of a View Connection Server group to VCSG01.
vdmadmin -C -c VCSG01
67
View Integration
What to do next
Complete the procedure described in “Import the View Management Packs on the SCOM Server,” on
page 68.
View Management Packs
View management packs enable you to use SCOM to monitor and manage the state of View components.
Table 5‑1. View Management Packs
View Management PackDescription
VMware.View.Discovery.mp
VMware.View.Monitoring.mp
VMware.View.Library.mp
VMware.View.Image.Library.mp
The View management packs are installed in the C:\Program Files\VMware\VMware
View\Server\extras\ManagementPacks directory on a View Connection Server instance or security server
when you install the View Connection Server software.
Contains the agent that discovers instances of View Server installations.
Contains the views and monitors that you can use with View in the
Operations Manager console.
Contains class and relationship definitions for the managed objects in
View.
Contains graphics that represent the classes defined in
VMware.View.Library.mp.
The View management packs require the default System management pack that is installed with SCOM and
the management pack for Microsoft Windows Server Base OS System Center Operations Manager 2007.
Import the View Management Packs on the SCOM Server
You must import the View management packs on the SCOM server to use SCOM to monitor and manage
the state of View components.
IMPORTANT McAfee VirusScan Enterprise 8.0i blocks the operation of Visual Basic scripts that SCOM uses.
For more information and details about the available patch, go to
http://support.microsoft.com/kb/890736/en-us.
Prerequisites
Complete the procedure described in “Assign a Name to the View Connection Server Group,” on
n
page 67.
Become familiar with the View management packs. See “View Management Packs,” on page 68.
n
Procedure
1Copy the View management packs from the View Connection Server instance or security server to the
SCOM server.
The View management packs are in the C:\Program Files\VMware\VMware
View\Server\extras\ManagementPacks directory on the View Connection Server host or security server.
2In the Operations Manager console, go to Administration\Management Packs and select Import
Management Packs.
3Use the Import Management Packs wizard to import the View management packs.
What to do next
Complete the procedure described in “Enable a Proxy Agent on a View Connection Server Host or Security
Server,” on page 69.
68 VMware, Inc.
Chapter 5 Integrating View with Microsoft SCOM
Enable a Proxy Agent on a View Connection Server Host or Security Server
You must use the Operations Manager console to enable a proxy agent on each View Connection Server host
or security server that you want to monitor with SCOM. The discovery script can discover a Windows
server only if you enable the proxy agent for the server.
Prerequisites
Complete the procedure described in “Import the View Management Packs on the SCOM Server,” on
page 68.
Procedure
1In the Operations Manager console, go to Administration\Agent Managed, select the server, and click
Properties.
2On the Security tab, select the Allow this agent to act as a proxy and discover managed objects on
other computers option.
3Click OK to save your changes.
Run the Discovery Script in the Operations Manager Console
The discovery script finds systems on which a View server is installed. It probes the registries of Windows
servers for entries that indicate the version of the View software, the type of server, and the name and ID of
the View Connection Server group.
NOTE Running the discovery script manually is optional. The discovery script is scheduled to run
automatically once every hour.
Prerequisites
Complete the procedure described in “Import the View Management Packs on the SCOM Server,” on
n
page 68.
Complete the procedure described in “Enable a Proxy Agent on a View Connection Server Host or
n
Security Server,” on page 69. The discovery script can discover a Windows server only if you use the
Operations Manager console to enable the proxy agent for the server.
Procedure
1In the Operations Manager console, go to Monitoring\Windows Computers.
2Select a computer system and click the VMware View Run Discovery Probe action.
If the discovery script detects that a View server is installed on a computer, it creates instances of the View
object classes that are defined in the VMware.View.Library management pack and establishes relationships
between these managed objects.
For a list of the managed objects for View Connection Server instances and security servers, see “View
Connection Server and Security Server Managed Objects,” on page 70. For information about the View
object classes and their relationships, see “View Object Classes and Relationships,” on page 70.
What to do next
(Optional) Verify the objects that the discovery script creates for a server by viewing the objects in the
Operations Manager console. See “Display Discovered and Managed View Objects,” on page 74.
VMware, Inc. 69
View Integration
View Connection Server and Security Server Managed Objects
The discovery script discovers managed objects for View Connection Server instances and security servers.
Table 5‑2. Managed Objects for View Connection Server Instances and Security Servers
View Connection Server
Object
VMware.View.Cluster
VMware.View.Cluster.Node.Item
VMware.View.ConnectionServerRole.Item
VMware.View.Component.ConnectionServer.Item
VMware.View.Component.Framework.Item
VMware.View.Component.Web.Item
VMware.View.Component.Directory.Item
VMware.View.Component.SecureGateway.Item
VMware.View.Component.MessageBus.Item
VMware.View.Component.SecurityServer.Item
InstanceSecurity Server
XX
XX
XX
XX
XX
X
X
XX
X
X
View Object Classes and Relationships
The VMware.View.Library management pack contains class and relationship definitions for the View
management packs. A class can have properties, such as a name or ID. The relationships between classes
describe their hierarchy. For example, the relationship contains exists between VMware.View.Clusters and
VMware.View.Cluster, and between VMware.View.Cluster and VMware.View.Cluster.Node.
The VMware.View.Library management pack also contains friendly name strings for classes and properties.
The SCOM console displays friendly names in preference to class and property names.
View Connection Server Group Classes
The VMware.View.Library management pack contains View Connection Server group class definitions.
Table 5‑3. View Library View Connection Server Group Classes
Class NameDescription
VMware.View.Cluster
VMware.View.Clusters
Base Classes
The VMware.View.Library management pack contains abstract base class definitions.
Represents a View Connection Server group. This class has the properties
ClusterID and DisplayName (the name of the group).
Represents a singleton class that contains instances of
VMware.View.Cluster.
NOTE The currently supported instances that are derived from these classes must be View 5.1.x or a later
release.
70 VMware, Inc.
Table 5‑4. View Library Base Classes
Class NameDescription
VMware.View.Cluster.Node
VMware.View.Component
VMware.View.Component.ConnectionSe
rver
VMware.View.Component.Directory
VMware.View.Component.Framework
VMware.View.Component.MessageBus
VMware.View.Component.SecurityGate
way
VMware.View.Component.SecurityServ
er
VMware.View.Component.Web
VMware.View.ConnectionServerRole
VMware.View.NodeRole
VMware.View.SecurityServerRole
Represents a member of a View Connection Server group. This class has the
properties ClusterID, ClusterName, ProductVersion, and InstallPath.
Represents a View component that has been installed on a member of a
View Connection Server group. This class has the property Name.
Represents the Connection Server component that has been installed on a
member of a View Connection Server group. This class inherits its
properties from VMware.View.Component.
Represents the Directory component that has been installed on a member of
a View Connection Server group. This class inherits its properties from
VMware.View.Component.
Represents the Framework component that has been installed on a member
of a View Connection Server group. This class inherits its properties from
VMware.View.Component.
Represents the Message Bus component that has been installed on a
member of a View Connection Server group. This class inherits its
properties from VMware.View.Component.
Represents the Security Gateway component that has been installed on a
member of a View Connection Server group. This class inherits its
properties from VMware.View.Component.
Represents the Security Server component that has been installed on a
member of a View Connection Server group. This class inherits its
properties from VMware.View.Component.
Represents the Web component that has been installed on a member of a
View Connection Server group. This class inherits its properties from
VMware.View.Component.
Represents a member of a View Connection Server group with the
Connection Server installed on it. This class inherits its properties from
VMware.View.NodeRole.
Represents the role of a member of a View Connection Server group.
Represents a member of a View Connection Server group with the Security
Server installed on it. This class inherits its properties from
VMware.View.NodeRole.
Chapter 5 Integrating View with Microsoft SCOM
Concrete Classes
The VMware.View.Library management pack contains concrete class definitions.
NOTE These concrete classes are the latest versions and are supported in View 5.1.x and later releases.
Table 5‑5. View Library Concrete Classes
Class NameDescription
VMware.View.Cluster.Node.Item
VMware.View.Component.ConnectionServe
r.Item
VMware, Inc. 71
Represents a View Connection Server group member that has version
5.1.x or a later release of View installed. This class inherits its properties
from VMware.View.Cluster.Node.
Represents version 5.1.x or a later release of the Connection Server
component that has been installed on a member of a View Connection
Server group. This class inherits its properties from
VMware.View.Component.ConnectionServer.
Represents version 5.1.x or a later release of the Directory component
that has been installed on a member of a View Connection Server group.
This class inherits its properties from
VMware.View.Component.Directory.
Represents version 5.1.x or a later release of the Framework component
that has been installed on a member of a View Connection Server group.
This class inherits its properties from
VMware.View.Component.Framework.
Represents version 5.1.x or a later release of the Message Bus
component that has been installed on a member of a View Connection
Server group. This class inherits its properties from
VMware.View.Component.MessageBus.
Gateway component that has been installed on a member of a View
Connection Server group. This class inherits its properties from
VMware.View.Component.SecureGateway.
Represents version 5.1.x or a later release of the Security Server
component that has been installed on a member of a View Connection
Server group. This class inherits its properties from
VMware.View.Component.SecurityServer.
Represents version 5.1.x or a later release of the Web component that
has been installed on a member of a View Connection Server group.
This class inherits its properties from VMware.View.Component.Web.
Represents a member of a View Connection Server group with version
5.1.x or a later release of the Connection Server installed on it. This class
inherits its properties from VMware.View.NodeRole.
Represents a member of a View Connection Server group with version
5.1.x or a later release of the Security Server installed on it. This class
inherits its properties from VMware.View.NodeRole.
Monitoring View in the Operations Manager Console
When View is integrated with SCOM, you can use the Operations Manager console to monitor and manage
View components.
Views and Monitors to Use with View
The VMware.View.Monitoring management pack contains the views and monitors that you can use to
monitor and manage View components in the Operations Manager console.
Views Available for View Objects
You can use the views defined in the VMware.View.Monitoring management pack to examine discovered
View objects.
Table 5‑6. Available Views for View Objects
ViewDescription
Active AlertsDisplays critical View alerts.
Node StateDisplays the state of all discovered members of all View Connection
Server groups.
Group StateDisplays the state of the discovered View Connection Server groups.
72 VMware, Inc.
Chapter 5 Integrating View with Microsoft SCOM
Table 5‑6. Available Views for View Objects (Continued)
ViewDescription
GroupsDisplays a diagram of all discovered View Connection Server groups,
members, roles, and components. You can obtain details about objects
and their relationships by clicking the icons and the connectors.
Connection Server Role Performance DataDisplays the following data sets.
All Sessions
n
All Sessions High
n
SVI Sessions
n
SVI Sessions High
n
Secure Gateway Role Performance DataDisplays the following data sets.
Secure Gateway Sessions
n
Secure Gateway Sessions High
n
Available Monitor Types for View Objects
The VMware.View.Monitoring management pack provides the following monitor types.
Performance monitor
Collects system data and return this data to the SCOM performance database
and data warehouse. You can examine the data graphically in the Connection
Server Role Performance Data and Secure Gateway Role Performance Data
views.
Service component
monitors
Collect information about the state of the View component services. If a
monitored service is not running, SCOM sets its state to error and raises an
alert. If a component is in the error state, the affected View Connection
Server group and its members also enter the error state.
Domain connectivity
monitor
Verifies that a View Connection Server instance can bind to all the domains
of which it is a member. The monitor queries the status of the Web
component on a View Connection Server instance every three minutes. If a
View Connection Server instance cannot bind to a domain, SCOM sets its
state to error and raises an alert.
Event database
connectivity monitor
Checks that the event database is configured and that events are writable to
the database. The monitor queries the Web component every three minutes
for this information and raises an alert if the event database is not connected.
Virtual Center (vCenter)
connectivity monitor
Checks that a View Connection Server instance can connect to the configured
vCenter Server instances. The monitor queries the Web component every
three minutes for this information and raises an alert if a vCenter Server
instance is not available.
Service Component Monitors for View Connection Server Instances
The following table describes the service component monitors that the VMware.View.Monitoring
management pack provides for View Connection Server instances.
Table 5‑7. View Service Component Monitors for a View Connection Server Instance
MonitorDisplay NameMonitored Service
ConnectionServerServiceCheckConnection Server Service HealthVMware View Connection Server
FrameworkServiceCheckBase Framework Service HealthVMware View Framework
Component
MessageBusServiceCheckMessage Bus Service HealthVMware View Message Bus
Component
VMware, Inc. 73
View Integration
Table 5‑7. View Service Component Monitors for a View Connection Server Instance (Continued)
MonitorDisplay NameMonitored Service
SecureGatewayCheckSecurity Gateway Service HealthVMware View Security Gateway
WebServiceCheckWeb Service HealthVMware View Web Component
DirectoryServiceCheckDirectory Service HealthVMwareVDMDS
Service Component Monitors for Security Servers
The following table describes the service component monitors that the VMware.View.Monitoring
management pack provides for security servers.
Table 5‑8. View Server Component Monitors for a Security Server
MonitorDisplay NameMonitored Service
SecureGatewayServerServiceCheckSecurity Server Service HealthVMware View Security Server
FrameworkServiceCheckBase Framework Service HealthVMware View Framework Component
SecureGatewayCheckSecurity Gateway Service HealthVMware View Security Gateway
Component
Component
Display Discovered and Managed View Objects
You can display discovered and managed View objects in the Operations Manager console.
Prerequisites
Integrate View with SCOM. See “Setting Up a SCOM Integration,” on page 67.
Procedure
To display the View objects that the discovery script creates for a server, go to Monitoring\Discovery
n
Inventory in the Operations Manager console.
To display the View objects that SCOM manages and the relationships between those objects, go to
n
Monitoring\VMware View in the Operations Manager console and select the required view.
Display Performance Information
You can display graphical performance data for a View Connection Server instance or security server in the
Operations Manager console.
Prerequisites
Integrate View with SCOM. See “Setting Up a SCOM Integration,” on page 67.
Procedure
1In the Operations Manager console, go to Monitoring\VMware View\Performance.
2Select the Connection Server Role Performance Data or Secure Gateway Role Performance Data view.
3Select the required data sets.
74 VMware, Inc.
Chapter 5 Integrating View with Microsoft SCOM
Display Alerts for a View Connection Server Group
You can use the Health Explorer in the Operations Manager console to display information about alerts that
the health monitors raise for a View Connection Server group.
Prerequisites
Integrate View with SCOM. See “Setting Up a SCOM Integration,” on page 67.
Procedure
1In the Operations Manager console, go to Monitoring\VMware View and select the Active Alerts view.
2Select an alert to display the knowledge article for that alert.
Close an Alert
You can close an alert in the Operations Manager console without taking any action.
NOTE This method does not prevent the alert from being raised again if the underlying cause persists.
Prerequisites
Integrate View with SCOM. See “Setting Up a SCOM Integration,” on page 67.
Procedure
1In the Operations Manager console, go to Monitoring\VMware View and select the Active Alerts view.
2Select the alert and click the Close Alert action.
Restart a View Component Service
You can restart a service from the Health Explorer in the Operations Manager console. The service
component monitors alert you if a View component service stops working.
Prerequisites
Integrate View with SCOM. See “Setting Up a SCOM Integration,” on page 67.
Procedure
1In the Operations Manager console, go to Monitoring\VMware View and select the Group State view
or the Group Node State view.
2Right-click a View Connection Server group or member that is in the alert state and select Open >
Health Explorer.
3In the Health Explorer, select the alert and click Restart the service in the knowledge article.
Exclude a Domain from Connectivity Monitoring
The Domain Connectivity Health monitor checks the connectivity between a View Connection Server host’s
domain and any trusted domains. To avoid seeing alerts for a domain, you can exclude the domain from
connectivity monitoring.
Prerequisites
Integrate View with SCOM. See “Setting Up a SCOM Integration,” on page 67.
VMware, Inc. 75
View Integration
Procedure
1In the Operations Manager console, go to Monitoring\VMware View and select the Group State view
2Right-click the View Connection Server instance and select Open > Health Explorer.
3Right-click the Domain Connectivity Health entry for the View Connection Server instance in the
4On the Overrides tab, click Override and select the option for all objects of the same class.
5In the Override Properties window, select the Override check box for the DomainExcludeList
6Click Apply and then click OK to save your changes.
or the Group Node State view.
Health Explorer and select Monitor Properties.
parameter, type the name of the excluded domain in the Override Setting text box, and select the
Enforced check box.
To exclude more than one domain, use spaces to separate the domain names.
76 VMware, Inc.
Examining PCoIP Session Statistics
with WMI6
You can use Windows Management Instrumentation (WMI) to examine performance statistics for a PCoIP
session by using any of the supported programming interfaces, including C#, C++, PowerShell, VBScript,
VB .NET, and Windows Management Instrumentation Command-line (WMIC).
You can also use the Microsoft WMI Code Creator tool to generate VBScript, C#, and VB .NET code that
accesses the PCoIP performance counters. For more information about WMI, WMIC, and the WMI Code
Creator tool, go to http://technet.microsoft.com/en-us/library/bb742610.aspx and
“Examples of Using PowerShell cmdlets to Examine PCoIP Statistics,” on page 82
n
Using PCoIP Session Statistics
The WMI namespace for the PCoIP session statistics is root\CIMV2. The names of the statistics are suffixed
with (Server) or (Client), according to whether the statistic is recorded on the PCoIP server or PCoIP
client.
You can use Windows Performance Monitor (PerfMon) with the counters to calculate averages over a
specified sampling period. You must have administrator privileges to access the performance counters
remotely.
All statistics are reset to 0 when a PCoIP session is closed. If the WMI SessionDurationSeconds property is a
non-zero value and stays constant, the PCoIP server was forcefully ended or crashed. If the
SessionDurationSeconds property changes from a non-zero value to 0, the PCoIP session is closed.
To avoid a division-by-zero error, verify that the denominator in the expressions for calculating bandwidth
or packet-loss percentage does not evaluate to zero.
USB statistics are recorded for zero clients, but not for thin clients or software clients.
VMware, Inc.
77
View Integration
General PCoIP Session Statistics
The WMI class name for PCoIP general session statistics is
To calculate the bandwidth in kilobits per second for transmitted PCoIP data over the time interval from
time t1 to time t2, use the following formula.
Do not use AudioTXBWkbitPersec for this calculation.
Calculating Bandwidth for Transmitted Audio Data
To calculate the bandwidth in kilobits per second for transmitted audio data over the time interval from
time t1 to time t2, use the following formula.
Total number of bytes of imaging data that have been
received since the PCoIP session started.
Total number of bytes of imaging data that have been
transmitted since the PCoIP session started.
Estimated processing capability of the imaging decoder in
kilobits per second. This statistic is updated once per
second.
Number of imaging frames that were encoded over a onesecond sampling period.
Lowest encoded quality value on a scale from 0 to 100. This
statistic is updated once per second. This counter does not
correspond to the GPO setting for minimum quality.
Bandwidth for incoming imaging packets averaged over
the sampling period, in seconds.
Bandwidth for outgoing imaging packets averaged over
the sampling period, in seconds.
VMware, Inc. 79
View Integration
Calculating Bandwidth for Received Imaging Data
To calculate the bandwidth in kilobits per second for received imaging data over the time interval from time
Do not use ImagingRXBWkbitPersec for the calculation.
Calculating Bandwidth for Transmitted Imaging Data
To calculate the bandwidth in kilobits per second for transmitted imaging data over the time interval from
time t1 to time t2, use the following formula.
To calculate the packet loss in percentage for received data over the time interval from time t1 to time t2,
use the following formula.
PacketsReceived during interval = (PacketsReceived[t2]-PacketsReceived[t1])
RXPacketsLost during interval = (RXPacketsLost[t2]-RXPacketsLost[t1])
RXPacketsLost % = RXPacketsLost during interval /
(RXPacketsLost during interval + PacketsReceived during interval) * 100
Do not use RXPacketLostPercent or RXPacketLostPercent_Base for the calculation.
Calculating Packet Loss for Transmitted Network Data
To calculate the packet loss in percentage for transmitted data over the time interval from time t1 to time t2,
use the following formula.
PacketsSent during interval = (PacketsSent[t2]-PacketsSent[t1])
TXPacketsLost during interval = (TXPacketsLost[t2]-TXPacketsLost[t1])
TXPacketsLost % = TXPacketsLost during interval /
(TXPacketsLost during interval + PacketsSent during interval) * 100
Do not use TXPacketLostPercent or TXPacketLostPercent_Base for the calculation.
Use this formula to prevent the packet loss percent from becoming greater than 100 percent. This calculation
is required because PacketsLost and PacketsSent are asynchronous.
In the following example, the Get-WmiObject cmdlet retrieves the PCoIP general session statistics for desktop
dt-03 if any transmitted packets have been lost.
Get-WmiObject -namespace "root\cimv2" -computername desktop-03 -query "select * from
Win32_PerfRawData_TeradiciPerf_PCoIPSessionGeneralStatistics where TXPacketsLost > 0"
82 VMware, Inc.
Setting Desktop Policies with Start
Session Scripts7
With start session scripts, you can configure specific View desktop settings before a desktop session starts
based on information received from Horizon Client and View Connection Server.
For example, you can use a start session script to configure desktop policies based on client device and user
location instead of setting up multiple desktop pools that have different desktop policies. A start session
script can enable mapped drives, clipboard redirection, and other desktop features for a user who has an IP
address in your organization’s internal domain, but disallow these features for a user who has an IP address
in an external domain.
This chapter includes the following topics:
“Obtaining Input Data for a Start Session Script,” on page 83
n
“Best Practices for Using Start Session Scripts,” on page 83
n
“Preparing a View Desktop to Use a Start Session Script,” on page 84
n
“Sample Start Session Scripts,” on page 86
n
Obtaining Input Data for a Start Session Script
Start session scripts cannot run interactively. A start session script runs in an environment created by View
and must obtain its input data from that environment.
Start session scripts gather input data from environment variables on the client computer. Start session
environment variables have the prefix VDM_StartSession_. For example, the start session environment
variable that contains the client system’s IP address is VDM_StartSession_IP_Address. You must ensure that
a start session script validates the existence of any environment variable that it uses.
For a list of variables similar to start session environment variables, see “Client System Information Sent to
View Desktops” in the Setting Up Desktop and Application Pools in View document.
Best Practices for Using Start Session Scripts
Follow these best practices when using start session scripts.
When to Use Start Session Scripts
Use start session scripts only if you need to configure desktop policies before a session starts.
As a best practice, use the Horizon Agent CommandsToRunOnConnect and CommandsToRunOnReconnect group
policy settings to run command scripts after a desktop session is connected or reconnected. Running scripts
within a desktop session, rather than using start session scripts, satisfies most use cases.
For more information, see “Running Commands on View Desktops” in the Setting Up Desktop andApplication Pools in View document.
VMware, Inc.
83
View Integration
Managing Start Session Timeouts
Make sure your start session scripts run quickly.
If you set the WaitScriptsOnStartSession value in the Windows registry, your start session script must
finish running before Horizon Agent can respond to the StartSession message that View Connection Server
sends. A long-running script is likely to cause the StartSession request to time out.
If a timeout occurs and the pool uses floating assignments, View Connection Server tries to connect the user
to another virtual machine. If a timeout occurs and no virtual machine is available, View Connection Server
rejects the user's connection request.
As a best practice, set a hard timeout for the script host operation so that a specific error can be returned if a
script runs too long.
Making Start Session Scripts Accessible
The path where you configure your start session scripts must be accessible only to the SYSTEM account and
to local administrators. Set the ACL for the base key to be accessible to these accounts only.
As a best practice, place start session scripts in the View_Agent_install_path\scripts directory, for example:
By default, this directory is accessible only by the SYSTEM and administrator accounts.
Preparing a View Desktop to Use a Start Session Script
To prepare a View desktop to use a start session script, you must enable the VMware View Script Host
service and add entries in the Windows registry.
You must configure all View desktops that need to run start session scripts. View does not provide a
mechanism to propagate registry changes, VMware View Script Host service configuration changes, and
start session scripts to multiple View desktop virtual machines.
Enable the VMware View Script Host Service
You must enable the VMware View Script Host service on each View desktop virtual machine where you
want View to run a start session script. The VMware View Script Host service is disabled by default.
When you configure the VMware View Script Host service, you can optionally specify the user account
under which the start session script runs. Start session scripts run in the context of the VMware View Script
Host service. By default, the VMware View Host Script service is configured to run as the SYSTEM user.
IMPORTANT Start session scripts are run outside a desktop user session and not by the desktop user account.
Information is sent directly from the client computer within a script running as the SYSTEM user.
Procedure
1Log in to the View desktop virtual machine.
2At the command prompt, type services.msc to start the Windows Services tool.
3In the details pane, right-click the VMware View Script Host service entry and select Properties.
4On the General tab, select Automatic from the Startup type drop-down menu.
5(Optional) If you do not want the local System account to run the start session script, select the Log On
tab, select This account, and type the user name and password of the account to run the start session
script.
6Click OK and exit the Windows Services tool.
84 VMware, Inc.
Chapter 7 Setting Desktop Policies with Start Session Scripts
Add Windows Registry Entries for a Start Session Script
You must add Windows registry entries on each View desktop virtual machine where you want View to run
a start session script.
Prerequisites
Verify that the path where you configured your start session scripts is accessible only to the SYSTEM
n
account and local administrators. For more information, see “Making Start Session Scripts Accessible,”
on page 84.
Make sure your start session scripts run quickly. If you set the WaitScriptsOnStartSession value in the
n
Windows registry, your start session script must finish running before Horizon Agent can respond to
the StartSession message that View Connection Server sends. For more information, see “Managing
Start Session Timeouts,” on page 84.
Procedure
1Log in to the View desktop virtual machine.
2At the command prompt, type regedit to start the Windows Registry Editor.
3In the registry, navigate to HKLM\SOFTWARE\VMware, Inc.\VMware VDM\ScriptEvents.
4Add the path to the start session script to the registry.
aIn the navigation area, right-click ScriptEvents, select New > Key, and create a key named
StartSession.
bIn the navigation area, right-click StartSession, select New > String Value, and create a string
value that identifies the start session script to run, for example, SampleScript.
To run more than one start session script, create a string value entry for each script under the
StartSession key. You cannot specify the order in which these scripts run. If the scripts must run
in a particular order, invoke them from a single control script.
cIn the topic area, right-click the entry for the new string value and select Modify.
dIn the Value data text box, type the command line that invokes the start session script and click
OK.
Type the full path of the start session script and any files that it requires.
5Add and enable a start session value in the registry.
aNavigate to HKLM\SOFTWARE\VMware, Inc.\VMware VDM\Agent\Configuration.
b(Optional) If the Configuration key does not exist, right-click Agent, select New > Key, and create
the key.
cIn the navigation area, right-click Configuration, select New > DWORD (32 bit) Value, and type
RunScriptsOnStartSession.
dIn the topic area, right-click the entry for the new DWORD value and select Modify.
VMware, Inc. 85
View Integration
6Set a registry value to specify timeout values in seconds rather than minutes to prevent scripts from
eIn the Value data text box, type 1 to enable start session scripting and click OK.
You can type 0 to disable this feature. The default value is 0.
f(Optional) To delay the StartSession response by Horizon Agent, add a second DWORD value to
the Configuration key called WaitScriptsOnStartSession.
A WaitScriptsOnStartSession data value of 1 causes Horizon Agent to delay sending a
StartSession response and fail if the scripts do not complete. A value of 0 means that
Horizon Agent does not wait for the scripts to complete or check script exit codes before sending
the StartSession response. The default value is 0.
timing out.
Setting this timeout value in seconds enables you to configure the VMware View Script Host service
timeout value in seconds. For example, if you set the VMware View Script Host service timeout to 30
seconds, you can ensure that a start session script either finishes running or times out before a View
Connection Server timeout occurs.
aNavigate to HKLM\SOFTWARE\VMware, Inc.\VMware VDM\ScriptEvents.
bAdd a DWORD value called TimeoutsInMinutes.
cSet a data value of 0.
7(Optional) To enable the VMware View Script Host service to time out the start session script, set a
timeout value.
aNavigate to HKLM\SOFTWARE\VMware, Inc.\VMware VDM\ScriptEvents\StartSession.
bIn the topic area, right-click the Default (@) key and select Modify.
cIn the Value data text box, type the timeout value and click OK.
A value of 0 means that no timeout is set.
8Exit the Registry Editor and restart the system.
Sample Start Session Scripts
These sample start session scripts illustrate how to write environment variables to a file, test the timeout
functionality, and test a non-zero exit code.
The following sample Visual Basic script writes all the environment variables provided to the script into a
file. You can use this sample script to see example data in your own environment. You might save this script
as C:\sample.vbs.
Option Explicit
Dim WshShell, FSO, outFile, strOutputFile, objUserEnv, strEnv
strOutputFile = "c:\setvars.txt"
Set FSO = CreateObject("Scripting.fileSystemObject")
Set outFile = FSO.CreateTextFile(strOutputFile, TRUE)
outFile.WriteLine("Script was called at (" & Now & ")")
Set WshShell = CreateObject( "WScript.Shell" )
Set objUserEnv = WshShell.Environment("PROCESS")
For Each strEnv In objUserEnv
86 VMware, Inc.
outFile.WriteLine(strEnv)
Next
outFile.Close
The following sample script tests the timeout functionality.
Option Explicit
WScript.Sleep 60000
The following sample script tests a non-zero exit code.
Option Explicit
WScript.Quit 2
Chapter 7 Setting Desktop Policies with Start Session Scripts
VMware, Inc. 87
View Integration
88 VMware, Inc.
Index
A
Active Directory users and groups 43
advanced PowerShell commands 46
alerts 75
assigning a name 67
automatically provisioned desktop pools 41