Investigating the vCAC 5.2 mgmtContext
[UPDATE 2014-02-16] For an introduction of vCAC other models have have a look at Investigating vCAC 5.2 Models. One of the cool features of vCAC is the ability to hook […]
Audit and Consulting of Information Systems and Business Processes
[UPDATE 2014-02-16] For an introduction of vCAC other models have have a look at Investigating vCAC 5.2 Models. One of the cool features of vCAC is the ability to hook […]
[UPDATE 2014-02-16] For an introduction of vCAC other models have have a look at Investigating vCAC 5.2 Models.
One of the cool features of vCAC is the ability to hook into the various steps of the provisioning process via scripting – especially with Windows PowerShell. As vCAC is built on top of ,NET it is really easy to use these assemblies via PoSH – especially the assembly for the repository. If you ever used the vCAC Workflow Designer for one of the pre-defined “WFStub” workflows you are already using the assembly that holds most of the repository: “mgmtContext”:
Ever wondered what that “mgmtContext” really is and where does it come from? The ManagementModel actually resides within the “DynamicOps.ManagementModel.Client.dll” which you can also load manually within PoSH:
Add-Type -Path ("{0}\VMware\vCAC\Server\DynamicOps.ManagementModel.Client.dll" -f ${ENV:ProgramFiles(x86)})
From there you can use the object “DynamicOps.ManagementModel.ManagementModelEntities” and its methods and properties to your needs. For example you could use it to update custom properties on a virtual machine or lookup information from agents and endpoints.
Problematic about this is that there is actually not much information on what the methods are and how to use them. However you can get a first look at it by browsing the ODATA REST interface via LINQPad:
But this does not tell you how to use it from PoSH and what methods and properties these objects have. But there is help: By looking up the contructor of the MangementModelEntities object as desribed in “Get-Constructor Fun” we create a new object and are now able to list its members and properties:
Get-Constructor DynamicOps.ManagementModel.ManagementModelEntities $m = New-Object -Type DynamicOps.ManagementModel.ManagementModelEntities -ArgumentList "https://localhost/Repository/Data/ManagementModelEntities.svc" $m|gm TypeName: DynamicOps.ManagementModel.ManagementModelEntities Name MemberType Definition ---- ---------- ---------- ReadingEntity Event System.EventHandler`1[System.Data.Services.Client.ReadingWritingEntityEventArgs]... SendingRequest Event System.EventHandler`1[System.Data.Services.Client.SendingRequestEventArgs] Sendi... WritingEntity Event System.EventHandler`1[System.Data.Services.Client.ReadingWritingEntityEventArgs]... AddLink Method void AddLink[T](T source, System.Linq.Expressions.Expression[System.Func[T,Syste... AddMultipleLicenseKeyRequest Method string AddMultipleLicenseKeyRequest(string serialNumbers) AddObject Method void AddObject(string entitySetName, System.Object entity) AddRelatedObject Method void AddRelatedObject(System.Object source, string sourceProperty, System.Object... AddToAgent Method void AddToAgent(DynamicOps.ManagementModel.Agent value) AddToAgentCapabilities Method void AddToAgentCapabilities(DynamicOps.ManagementModel.AgentCapability value) AddToAlertEmailAddresses Method void AddToAlertEmailAddresses(DynamicOps.ManagementModel.AlertEmailAddress value) AddToAlertItems Method void AddToAlertItems(DynamicOps.ManagementModel.AlertItem value) AddToAlerts Method void AddToAlerts(DynamicOps.ManagementModel.Alert value) AddToAnnouncements Method void AddToAnnouncements(DynamicOps.ManagementModel.Announcement value) AddToAppAppearances Method void AddToAppAppearances(DynamicOps.ManagementModel.AppAppearance value) AddToApprovalDefinitions Method void AddToApprovalDefinitions(DynamicOps.ManagementModel.ApprovalDefinition value) AddToApprovalInstanceItems Method void AddToApprovalInstanceItems(DynamicOps.ManagementModel.ApprovalInstanceItem ... AddToApprovalInstances Method void AddToApprovalInstances(DynamicOps.ManagementModel.ApprovalInstance value) AddToApprovalPolicies Method void AddToApprovalPolicies(DynamicOps.ManagementModel.ApprovalPolicy value) AddToAppServiceComponents Method void AddToAppServiceComponents(DynamicOps.ManagementModel.AppServiceComponent va... AddToAppServiceComponentTemplates Method void AddToAppServiceComponentTemplates(DynamicOps.ManagementModel.AppServiceComp... AddToAppServiceTemplates Method void AddToAppServiceTemplates(DynamicOps.ManagementModel.AppServiceTemplate value) AddToChangeStateRequests Method void AddToChangeStateRequests(DynamicOps.ManagementModel.ChangeStateRequest value) AddToConnectionCredentials Method void AddToConnectionCredentials(DynamicOps.ManagementModel.ConnectionCredential ... AddToControlInstances Method void AddToControlInstances(DynamicOps.ManagementModel.ControlInstance value) AddToControlLayouts Method void AddToControlLayouts(DynamicOps.ManagementModel.ControlLayout value) AddToControlTypes Method void AddToControlTypes(DynamicOps.ManagementModel.ControlType value) AddToCostProfiles Method void AddToCostProfiles(DynamicOps.ManagementModel.CostProfile value) AddToDataCollectionStatuses Method void AddToDataCollectionStatuses(DynamicOps.ManagementModel.DataCollectionStatus... AddToDisplayIcons Method void AddToDisplayIcons(DynamicOps.ManagementModel.DisplayIcon value) AddToEmailProfiles Method void AddToEmailProfiles(DynamicOps.ManagementModel.EmailProfile value) AddToEndpointUsageHistory Method void AddToEndpointUsageHistory(DynamicOps.ManagementModel.EndpointUsageHistory v... AddToEnterpriseAdminGroups Method void AddToEnterpriseAdminGroups(DynamicOps.ManagementModel.EnterpriseAdminGroup ... AddToFiles Method void AddToFiles(DynamicOps.ManagementModel.File value) AddToFilterSpecGroups Method void AddToFilterSpecGroups(DynamicOps.ManagementModel.FilterSpecGroup value) AddToFilterSpecs Method void AddToFilterSpecs(DynamicOps.ManagementModel.FilterSpec value) AddToGlobalProfileProperties Method void AddToGlobalProfileProperties(DynamicOps.ManagementModel.GlobalProfileProper... AddToGlobalProfiles Method void AddToGlobalProfiles(DynamicOps.ManagementModel.GlobalProfile value) AddToHostDiscoveries Method void AddToHostDiscoveries(DynamicOps.ManagementModel.HostDiscovery value) AddToHostExts Method void AddToHostExts(DynamicOps.ManagementModel.HostExt value) AddToHostNamePrefixes Method void AddToHostNamePrefixes(DynamicOps.ManagementModel.HostNamePrefix value) AddToHostNics Method void AddToHostNics(DynamicOps.ManagementModel.HostNic value) AddToHostNicToReservations Method void AddToHostNicToReservations(DynamicOps.ManagementModel.HostNicToReservation ... AddToHostProperties Method void AddToHostProperties(DynamicOps.ManagementModel.HostProperty value) AddToHostReservationPolicies Method void AddToHostReservationPolicies(DynamicOps.ManagementModel.HostReservationPoli... AddToHostReservationProperties Method void AddToHostReservationProperties(DynamicOps.ManagementModel.HostReservationPr... AddToHostReservations Method void AddToHostReservations(DynamicOps.ManagementModel.HostReservation value) AddToHostReservationStats Method void AddToHostReservationStats(DynamicOps.ManagementModel.HostReservationStats v... AddToHostReservationToStorages Method void AddToHostReservationToStorages(DynamicOps.ManagementModel.HostReservationTo... AddToHostReservationToStorageStats Method void AddToHostReservationToStorageStats(DynamicOps.ManagementModel.HostReservati... AddToHosts Method void AddToHosts(DynamicOps.ManagementModel.Host value) AddToHostStorageReservationPolicies Method void AddToHostStorageReservationPolicies(DynamicOps.ManagementModel.HostStorageR... AddToHostToIsoes Method void AddToHostToIsoes(DynamicOps.ManagementModel.HostToIso value) AddToHostToStorage Method void AddToHostToStorage(DynamicOps.ManagementModel.HostToStorage value) AddToInterfaceTypes Method void AddToInterfaceTypes(DynamicOps.ManagementModel.InterfaceType value) AddToIsoes Method void AddToIsoes(DynamicOps.ManagementModel.Iso value) AddToLicenseKeys Method void AddToLicenseKeys(DynamicOps.ManagementModel.LicenseKey value) AddToMachineCostViews Method void AddToMachineCostViews(DynamicOps.ManagementModel.MachineCostView value) AddToMachineOperations Method void AddToMachineOperations(DynamicOps.ManagementModel.MachineOperation value) AddToMachineStateHistories Method void AddToMachineStateHistories(DynamicOps.ManagementModel.MachineStateHistory v... AddToMachineUsageByStates Method void AddToMachineUsageByStates(DynamicOps.ManagementModel.MachineUsageByState va... AddToMachineUsageHistories Method void AddToMachineUsageHistories(DynamicOps.ManagementModel.MachineUsageHistory v... AddToManagementEndpointProperties Method void AddToManagementEndpointProperties(DynamicOps.ManagementModel.ManagementEndp... AddToManagementEndpoints Method void AddToManagementEndpoints(DynamicOps.ManagementModel.ManagementEndpoint value) AddToPhysicalControllers Method void AddToPhysicalControllers(DynamicOps.ManagementModel.PhysicalController value) AddToPhysicalMachineProperties Method void AddToPhysicalMachineProperties(DynamicOps.ManagementModel.PhysicalMachinePr... AddToPhysicalMachines Method void AddToPhysicalMachines(DynamicOps.ManagementModel.PhysicalMachine value) AddToPhysicalNetworks Method void AddToPhysicalNetworks(DynamicOps.ManagementModel.PhysicalNetwork value) AddToPhysicalStorages Method void AddToPhysicalStorages(DynamicOps.ManagementModel.PhysicalStorage value) AddToPropertyAttributes Method void AddToPropertyAttributes(DynamicOps.ManagementModel.PropertyAttribute value) AddToPropertyAttributeTypes Method void AddToPropertyAttributeTypes(DynamicOps.ManagementModel.PropertyAttributeTyp... AddToPropertyDefinitions Method void AddToPropertyDefinitions(DynamicOps.ManagementModel.PropertyDefinition value) AddToPropertyDefinitionSets Method void AddToPropertyDefinitionSets(DynamicOps.ManagementModel.PropertyDefinitionSe... AddToPropertyGroups Method void AddToPropertyGroups(DynamicOps.ManagementModel.PropertyGroup value) AddToPropertySetXml Method void AddToPropertySetXml(DynamicOps.ManagementModel.PropertySetXml value) AddToPropertyValues Method void AddToPropertyValues(DynamicOps.ManagementModel.PropertyValue value) AddToProvisioningGroupProperties Method void AddToProvisioningGroupProperties(DynamicOps.ManagementModel.ProvisioningGro... AddToProvisioningGroups Method void AddToProvisioningGroups(DynamicOps.ManagementModel.ProvisioningGroup value) AddToRequestAudits Method void AddToRequestAudits(DynamicOps.ManagementModel.RequestAudit value) AddToRequestProperties Method void AddToRequestProperties(DynamicOps.ManagementModel.RequestProperty value) AddToRequests Method void AddToRequests(DynamicOps.ManagementModel.Request value) AddToResourcePools Method void AddToResourcePools(DynamicOps.ManagementModel.ResourcePool value) AddToStateOperationDefinitionProperties Method void AddToStateOperationDefinitionProperties(DynamicOps.ManagementModel.StateOpe... AddToStateOperationDefinitions Method void AddToStateOperationDefinitions(DynamicOps.ManagementModel.StateOperationDef... AddToStateOperationExecutionStates Method void AddToStateOperationExecutionStates(DynamicOps.ManagementModel.StateOperatio... AddToStateOperationProperties Method void AddToStateOperationProperties(DynamicOps.ManagementModel.StateOperationProp... AddToStateOperations Method void AddToStateOperations(DynamicOps.ManagementModel.StateOperation value) AddToStaticIPv4Addresses Method void AddToStaticIPv4Addresses(DynamicOps.ManagementModel.StaticIPv4Address value) AddToStaticIPv4NetworkProfiles Method void AddToStaticIPv4NetworkProfiles(DynamicOps.ManagementModel.StaticIPv4Network... AddToStaticIPv4Ranges Method void AddToStaticIPv4Ranges(DynamicOps.ManagementModel.StaticIPv4Range value) AddToStorage Method void AddToStorage(DynamicOps.ManagementModel.Storage value) AddToStorageCostProfiles Method void AddToStorageCostProfiles(DynamicOps.ManagementModel.StorageCostProfile value) AddToUICustomizations Method void AddToUICustomizations(DynamicOps.ManagementModel.UICustomization value) AddToUserFilterExclusions Method void AddToUserFilterExclusions(DynamicOps.ManagementModel.UserFilterExclusion va... AddToUserFilters Method void AddToUserFilters(DynamicOps.ManagementModel.UserFilter value) AddToUserLogs Method void AddToUserLogs(DynamicOps.ManagementModel.UserLog value) AddToUsers Method void AddToUsers(DynamicOps.ManagementModel.User value) AddToVirtualMachineExts Method void AddToVirtualMachineExts(DynamicOps.ManagementModel.VirtualMachineExt value) AddToVirtualMachineHistories Method void AddToVirtualMachineHistories(DynamicOps.ManagementModel.VirtualMachineHisto... AddToVirtualMachineHistoryProperties Method void AddToVirtualMachineHistoryProperties(DynamicOps.ManagementModel.VirtualMach... AddToVirtualMachineProperties Method void AddToVirtualMachineProperties(DynamicOps.ManagementModel.VirtualMachineProp... AddToVirtualMachines Method void AddToVirtualMachines(DynamicOps.ManagementModel.VirtualMachine value) AddToVirtualMachineTemplateProperties Method void AddToVirtualMachineTemplateProperties(DynamicOps.ManagementModel.VirtualMac... AddToVirtualMachineTemplates Method void AddToVirtualMachineTemplates(DynamicOps.ManagementModel.VirtualMachineTempl... AddToVMDiskHardwares Method void AddToVMDiskHardwares(DynamicOps.ManagementModel.VMDiskHardware value) AddToVMPerformances Method void AddToVMPerformances(DynamicOps.ManagementModel.VMPerformance value) AddToVMSnapshots Method void AddToVMSnapshots(DynamicOps.ManagementModel.VMSnapshot value) AddToVMToNetwork Method void AddToVMToNetwork(DynamicOps.ManagementModel.VMToNetwork value) AddToWorkflowInfoes Method void AddToWorkflowInfoes(DynamicOps.ManagementModel.WorkflowInfo value) AddToWorkflowMaps Method void AddToWorkflowMaps(DynamicOps.ManagementModel.WorkflowMap value) AddToWorkflowOperationArguments Method void AddToWorkflowOperationArguments(DynamicOps.ManagementModel.WorkflowOperatio... AddToWorkflowOperations Method void AddToWorkflowOperations(DynamicOps.ManagementModel.WorkflowOperation value) AddToWorkflowStateEvents Method void AddToWorkflowStateEvents(DynamicOps.ManagementModel.WorkflowStateEvent value) AddToWorkItem Method void AddToWorkItem(DynamicOps.ManagementModel.WorkItem value) AllocateReservationRequest Method DynamicOps.ManagementModel.Common.Requests.AllocateRequest AllocateReservationRe... AttachIfNeeded Method void AttachIfNeeded(string entitySetName, System.Object entity) AttachLink Method void AttachLink(System.Object source, string sourceProperty, System.Object target) AttachTo Method void AttachTo(string entitySetName, System.Object entity), void AttachTo(string ... BeginExecute Method System.IAsyncResult BeginExecute[TElement](uri requestUri, System.AsyncCallback ... BeginExecuteBatch Method System.IAsyncResult BeginExecuteBatch(System.AsyncCallback callback, System.Obje... BeginGetReadStream Method System.IAsyncResult BeginGetReadStream(System.Object entity, System.Data.Service... BeginLoadProperty Method System.IAsyncResult BeginLoadProperty(System.Object entity, string propertyName,... BeginSaveChanges Method System.IAsyncResult BeginSaveChanges(System.AsyncCallback callback, System.Objec... CancelRequest Method void CancelRequest(System.IAsyncResult asyncResult) CheckLicenseQuotaRequest Method bool CheckLicenseQuotaRequest(byte templateType) CheckTemplateIsLicensedRequest Method bool CheckTemplateIsLicensedRequest(guid templateId) CreateDataServiceQuery Method System.Data.Services.Client.DataServiceQuery[T] CreateDataServiceQuery[T](string... CreateQuery Method DynamicOps.Repository.RepositoryServiceQuery[T] CreateQuery[T](string entitySetN... DeleteLink Method void DeleteLink[T](T source, System.Linq.Expressions.Expression[System.Func[T,Sy... DeleteObject Method void DeleteObject(System.Object entity) Detach Method bool Detach(System.Object entity) DetachLink Method bool DetachLink(System.Object source, string sourceProperty, System.Object target) EndExecute Method System.Collections.Generic.IEnumerable[TElement] EndExecute[TElement](System.IAs... EndExecuteBatch Method System.Data.Services.Client.DataServiceResponse EndExecuteBatch(System.IAsyncRes... EndGetReadStream Method System.Data.Services.Client.DataServiceStreamResponse EndGetReadStream(System.IA... EndLoadProperty Method System.Data.Services.Client.QueryOperationResponse EndLoadProperty(System.IAsync... EndSaveChanges Method System.Data.Services.Client.DataServiceResponse EndSaveChanges(System.IAsyncResu... Equals Method bool Equals(System.Object obj) Execute Method System.Collections.Generic.IEnumerable[TElement] Execute[TElement](uri requestUr... ExecuteBatch Method System.Data.Services.Client.DataServiceResponse ExecuteBatch(Params System.Data.... GenerateMachineName Method string GenerateMachineName(DynamicOps.ManagementModel.Common.Requests.MachineNam... GetEntityDescriptor Method System.Data.Services.Client.EntityDescriptor GetEntityDescriptor(System.Object e... GetEntitySetFromType Method string GetEntitySetFromType(type type) GetHashCode Method int GetHashCode() GetLinkDescriptor Method System.Data.Services.Client.LinkDescriptor GetLinkDescriptor(System.Object sourc... GetMetadataUri Method uri GetMetadataUri() GetReadStream Method System.Data.Services.Client.DataServiceStreamResponse GetReadStream(System.Objec... GetReadStreamUri Method uri GetReadStreamUri(System.Object entity) GetType Method type GetType() LoadProperty Method System.Data.Services.Client.QueryOperationResponse LoadProperty(System.Object en... SaveChanges Method System.Data.Services.Client.DataServiceResponse SaveChanges(), System.Data.Servi... SetLink Method void SetLink[T](T source, System.Linq.Expressions.Expression[System.Func[T,Syste... SetSaveStream Method void SetSaveStream(System.Object entity, System.IO.Stream stream, bool closeStre... SubmitVirtualMachineRequest Method guid SubmitVirtualMachineRequest(guid templateId, guid groupId, string requestin... ToString Method string ToString() TryGetEntity Method bool TryGetEntity[TEntity](uri identity, [ref] TEntity entity) TryGetUri Method bool TryGetUri(System.Object entity, [ref] uri identity) UpdateObject Method void UpdateObject(System.Object entity) ValidateLicenseKeyRequest Method DynamicOps.ManagementModel.LicenseKey ValidateLicenseKeyRequest(DynamicOps.Manag... Agent Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.Agent] A... AgentCapabilities Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.AgentCap... AlertEmailAddresses Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.AlertEma... AlertItems Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.AlertIte... Alerts Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.Alert] A... Announcements Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.Announce... AppAppearances Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.AppAppea... ApplyingChanges Property bool ApplyingChanges {get;} ApprovalDefinitions Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.Approval... ApprovalInstanceItems Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.Approval... ApprovalInstances Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.Approval... ApprovalPolicies Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.Approval... AppServiceComponents Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.AppServi... AppServiceComponentTemplates Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.AppServi... AppServiceTemplates Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.AppServi... BaseUri Property uri BaseUri {get;} ChangeStateRequests Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.ChangeSt... ConnectionCredentials Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.Connecti... ControlInstances Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.ControlI... ControlLayouts Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.ControlL... ControlTypes Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.ControlT... CostProfiles Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.CostProf... Credentials Property System.Net.ICredentials Credentials {get;set;} DataCollectionStatuses Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.DataColl... DataNamespace Property string DataNamespace {get;set;} DisplayIcons Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.DisplayI... EmailProfiles Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.EmailPro... EndpointUsageHistory Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.Endpoint... EnterpriseAdminGroups Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.Enterpri... Entities Property System.Collections.ObjectModel.ReadOnlyCollection[System.Data.Services.Client.En... Files Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.File] Fi... FilterSpecGroups Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.FilterSp... FilterSpecs Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.FilterSp... GlobalProfileProperties Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.GlobalPr... GlobalProfiles Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.GlobalPr... HostDiscoveries Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.HostDisc... HostExts Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.HostExt]... HostNamePrefixes Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.HostName... HostNics Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.HostNic]... HostNicToReservations Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.HostNicT... HostProperties Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.HostProp... HostReservationPolicies Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.HostRese... HostReservationProperties Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.HostRese... HostReservations Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.HostRese... HostReservationStats Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.HostRese... HostReservationToStorages Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.HostRese... HostReservationToStorageStats Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.HostRese... Hosts Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.Host] Ho... HostStorageReservationPolicies Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.HostStor... HostToIsoes Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.HostToIs... HostToStorage Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.HostToSt... IgnoreMissingProperties Property bool IgnoreMissingProperties {get;set;} IgnoreResourceNotFoundException Property bool IgnoreResourceNotFoundException {get;set;} InterfaceTypes Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.Interfac... Isoes Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.Iso] Iso... LicenseKeys Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.LicenseK... Links Property System.Collections.ObjectModel.ReadOnlyCollection[System.Data.Services.Client.Li... MachineCostViews Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.MachineC... MachineOperations Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.MachineO... MachineStateHistories Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.MachineS... MachineUsageByStates Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.MachineU... MachineUsageHistories Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.MachineU... ManagementEndpointProperties Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.Manageme... ManagementEndpoints Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.Manageme... MergeOption Property System.Data.Services.Client.MergeOption MergeOption {get;set;} PhysicalControllers Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.Physical... PhysicalMachineProperties Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.Physical... PhysicalMachines Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.Physical... PhysicalNetworks Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.Physical... PhysicalStorages Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.Physical... PropertyAttributes Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.Property... PropertyAttributeTypes Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.Property... PropertyDefinitions Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.Property... PropertyDefinitionSets Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.Property... PropertyGroups Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.Property... PropertySetXml Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.Property... PropertyValues Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.Property... ProvisioningGroupProperties Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.Provisio... ProvisioningGroups Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.Provisio... RequestAudits Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.RequestA... RequestProperties Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.RequestP... Requests Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.Request]... ResolveName Property System.Func[type,string] ResolveName {get;set;} ResolveType Property System.Func[string,type] ResolveType {get;set;} ResourcePools Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.Resource... SaveChangesDefaultOptions Property System.Data.Services.Client.SaveChangesOptions SaveChangesDefaultOptions {get;set;} StateOperationDefinitionProperties Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.StateOpe... StateOperationDefinitions Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.StateOpe... StateOperationExecutionStates Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.StateOpe... StateOperationProperties Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.StateOpe... StateOperations Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.StateOpe... StaticIPv4Addresses Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.StaticIP... StaticIPv4NetworkProfiles Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.StaticIP... StaticIPv4Ranges Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.StaticIP... Storage Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.Storage]... StorageCostProfiles Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.StorageC... Timeout Property int Timeout {get;set;} TypeScheme Property uri TypeScheme {get;set;} UICustomizations Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.UICustom... UsePostTunneling Property bool UsePostTunneling {get;set;} UserFilterExclusions Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.UserFilt... UserFilters Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.UserFilt... UserLogs Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.UserLog]... Users Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.User] Us... VirtualMachineExts Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.VirtualM... VirtualMachineHistories Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.VirtualM... VirtualMachineHistoryProperties Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.VirtualM... VirtualMachineProperties Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.VirtualM... VirtualMachines Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.VirtualM... VirtualMachineTemplateProperties Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.VirtualM... VirtualMachineTemplates Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.VirtualM... VMDiskHardwares Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.VMDiskHa... VMPerformances Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.VMPerfor... VMSnapshots Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.VMSnapsh... VMToNetwork Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.VMToNetw... WorkflowInfoes Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.Workflow... WorkflowMaps Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.Workflow... WorkflowOperationArguments Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.Workflow... WorkflowOperations Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.Workflow... WorkflowStateEvents Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.Workflow... WorkItem Property DynamicOps.Repository.RepositoryServiceQuery[DynamicOps.ManagementModel.WorkItem...
With that you can use normal PoSH mechanics to investigate on the methods and properties. But make sure you first set the “Credentials” proeprty of the mgmtContext with either explicit credentials or “DefaultCredentials” of the current identity. For example save changes or update an object:
PS > $m.SaveChanges OverloadDefinitions ------------------- System.Data.Services.Client.DataServiceResponse SaveChanges() System.Data.Services.Client.DataServiceResponse SaveChanges(System.Data.Services.Client.SaveChangesOptions options) PS > [System.Data.Services.Client.SaveChangesOptions] |gm -Static -Type Properties TypeName: System.Data.Services.Client.SaveChangesOptions Name MemberType Definition ---- ---------- ---------- Batch Property static System.Data.Services.Client.SaveChangesOptions Batch {get;} ContinueOnError Property static System.Data.Services.Client.SaveChangesOptions ContinueOnError {get;} None Property static System.Data.Services.Client.SaveChangesOptions None {get;} ReplaceOnUpdate Property static System.Data.Services.Client.SaveChangesOptions ReplaceOnUpdate {get;} PS > $m.UpdateObject OverloadDefinitions ------------------- void UpdateObject(System.Object entity)
Or you can use code to add a property to a virtual machine:
PS > $m.AddToVirtualMachineProperties OverloadDefinitions ------------------- void AddToVirtualMachineProperties(DynamicOps.ManagementModel.VirtualMachineProperty value) PS > get-Constructor DynamicOps.ManagementModel.VirtualMachineProperty VirtualMachineProperty( ) PS > get-Constructor DynamicOps.ManagementModel.VirtualMachineProperty $p = New-Object "DynamicOps.ManagementModel.VirtualMachineProperty" PS > $p Id : 0 PropertyName : PropertyValue : IsHidden : False IsRuntime : False IsEncrypted : False VirtualMachine :
All of this can then be used inside a vCAC workflow and a PoSH script that can be invoked via InvokePowerShell as described in “Powershell Scripting from vCAC Workflows (Southbound)” (make sure you read the comments to that post to make the example work).
One side note about how to use the object. Most entities are “linked” together. So if you want to add a new attribute to a property you have to create an PropertyAttribute object and the link it to its base Property object via “SetLink()”. When accessing objects (eg via $mgmtContext.GlobalProperties) you have to “detach” the objects via “Detach()” after use or you get strange results when the objects have been changed in the background.
7 Comments »