当我挖苦的VMware View的API,有几个人问我,如果在那里他们可以找到查看的API。虽然VMware不提供全套的API,但确实提供了基于PowerShell的命令行记录的VMware View集成指南。
Beyond that, the guide also introduces the event database with tables and schemas so that you can retrieve various events from the database directly; how to import/export LDAP data to/from View; and how to “use Microsoft System Center Operations Manager (SCOM) to monitor the state of VMware View components, including View Connection Server instances and security servers and View services running on these hosts.”
While trying the PowerShell CLI, I found the setup instruction is slightly different from my environment where View 4.5 is installed. After installing two basic components as stated in the doc: .NET Framework 2.0 (newer version should work but I didn’t try), and PowerShell 1.0 English Language Installation, I could not find the Start>All Programs>VMware>View>View PowerCLI, therefore could not run the cmdlets afterwards.
Here’s what I did to make it work after a little research on the Internet:
1. Install/register the View PowerShell snap-in dll;
PS> C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\installutil "C:\Program Files\VMware\VMware View\Server\bin\PowerShellServiceCmdlets.dll"
Then, the View snap-in shows with another cmdlet:
PS> get-PSsnapin –registered
2. Add the View broker snap-in
PS> add-pssnapin VMware.View.Broker
Once it’s done, you can list all the cmdlets:
PS> Get-Command -PSSnapin VMware.View.Broker | more
By then I could follow the guide to move forward.
Here are the comlets available (as the output of above cmdlet) so that you can have a sense what you can do with them. For more details, you can either use the Get-Help cmdlet or read the guide.
CommandType Name Definition ----------- ---- ---------- Cmdlet Add-AutomaticLinkedClonePool Add-AutomaticLinkedClonePool [-pool_id]... Cmdlet Add-AutomaticPool Add-AutomaticPool [-pool_id ] [-descript... Cmdlet Add-ManualPool Add-ManualPool [-pool_id ] [-description... Cmdlet Add-ManualUnmanagedPool Add-ManualUnmanagedPool [-pool_id ] [-de... Cmdlet Add-PoolEntitlement Add-PoolEntitlement [-pool_id ] [-sid ] [-des... Cmdlet Add-ViewVC Add-ViewVC [-serverName ] [-Name ] [-domain ... Cmdlet Get-ConnectionBroker Get-ConnectionBroker [[-broker_id] ] [... Cmdlet Get-DesktopPhysicalMachine Get-DesktopPhysicalMachine [-displayName ] [-Name ] [-startDate... Cmdlet Get-EventReportList Get-EventReportList [-Verbose] [-Debug] [-ErrorA... Cmdlet Get-GlobalSetting Get-GlobalSetting [-Verbose] [-Debug] [-ErrorAct... Cmdlet Get-License Get-License [-Verbose] [-Debug] [-ErrorAction ] [-poolDis... Cmdlet Get-Monitor Get-Monitor [-monitor ] [-monitor_id <... Cmdlet Get-Pool Get-Pool [-pool_id ] [-displayName ] [-Ve... Cmdlet Get-ProfileDisk Get-ProfileDisk [-Name ] [-Username ] [-pool_... Cmdlet Get-TerminalServer Get-TerminalServer [-displayName ] [-d... Cmdlet Get-User Get-User [-includeUser] [-includeGroup] [-name <... Cmdlet Get-ViewVC Get-ViewVC [-displayName ] [-descripti... Cmdlet Remove-Pool Remove-Pool [-pool_id ] [-DeleteFromDisk... Cmdlet Remove-PoolEntitlement Remove-PoolEntitlement [-pool_id ] [-sid... Cmdlet Remove-UserOwnership Remove-UserOwnership [[-machine_id] ] [-... Cmdlet Remove-ViewVC Remove-ViewVC [-vc_id ] [-Name ]... Cmdlet Send-LinkedCloneRebalance Send-LinkedCloneRebalance [-machine_id ]... Cmdlet Send-LinkedCloneRecompose Send-LinkedCloneRecompose [-machine_id ]... Cmdlet Send-LinkedCloneRefresh Send-LinkedCloneRefresh [-machine_id ] [... Cmdlet Send-LocalSessionRollback Send-LocalSessionRollback [-machine_id ]... Cmdlet Send-SessionDisconnect Send-SessionDisconnect [[-session_id] ] ... Cmdlet Send-SessionLogoff Send-SessionLogoff [[-session_id] ] [-Ve... Cmdlet Send-VMReset Send-VMReset [-machine_id ] [-id ] [-Verbose] [-Debug] ... Cmdlet Update-AutomaticLinkedClonePool Update-AutomaticLinkedClonePool [-pool_id ] [-descr... Cmdlet Update-ConnectionBroker Update-ConnectionBroker [-broker_id ] [-... Cmdlet Update-GlobalSetting Update-GlobalSetting [-SessionTimeout ] ... Cmdlet Update-ManualPool Update-ManualPool [-pool_id ] [-descript... Cmdlet Update-ManualUnmanagedPool Update-ManualUnmanagedPool [-pool_id ] [... Cmdlet Update-TerminalServerPool Update-TerminalServerPool [-pool_id ] [-... Cmdlet Update-UserOwnership Update-UserOwnership [-machine_id ] [-si... Cmdlet Update-ViewVC Update-ViewVC [-vc_id ] [-serverName