RSS
Логотип
Баннер в шапке 1
Баннер в шапке 2

VMware vSphere PowerCLI

Product
The name of the base system (platform): VMware vSphere
Developers: VMware
Last Release Date: 2022/01/17
Technology: ITSM - IT Service Management Systems

Content

Main article: IT Service Management (ITSM)

VMware vSphere PowerCLI is an extension product Microsoft PowerShell management commands. servers VMware

2022: PowerCLI 12.5

On January 17, 2022, VMware announced that version PowerCLI 12.5 had recently become available for download.

According to the company, there appeared:

vCenter Server Appliance Service Management Features

In the update PowerCLI 4 cmdlets appeared:

  • Get-VIApplianceService - gets the list of services vCenter Server Appliance (vCSA)
  • Start-VIApplianceService - starts one of the services
  • Stop-VIApplianceService - stops
  • Restart-VIApplianceService - restarts

PowerCLI 12.5

VMware Cloud on AWS Outpost Support

Now PowerCLI supports accessing the AWS onpremise infrastructure, which is called Outpost (became available at the end of 2021). To do this, there is a Get-VmcOutpost cmdlet that allows you to get a list of available outposts for your organization in VMC. Also, when creating SDDC using the New-VmcSddc cmdlet, there is a -Outpost parameter that allows you to create an object within an outpost.

Hot add/Remove support for processors and memory

Now there are parameters, in the cmdlets for creating and configuring VMs (Set-VM and New-VM), which allow you to enable the functions of hot adding memory and processors, as well as removing processors. Here are these options:

  • CpuHotAddEnabled (enable CPU Hot Add)
  • CpuHotRemoveEnabled (enable CPU Hot Remove)
  • MemoryHotAddEnabled (enable Memory Hot Add)

Enable encrypted migration vMotion

Now, for the Set-VM and New-VM creation and configuration cmdlets, there is a parameter - MigrationEncryption, which allows you to enable encrypted migration.

Updates for Horizon 8.4

Horizon has been upgraded to include Horizon 8.4 API banding The [1].

2021: PowerCLI 12.4

On September 20, 2021, it became known that the company VMware released an update to the main framework for management virtual infrastructure using team scenarios - PowerCLI 12.4.

There are several additional features in this version of the PowerCLI:

API Interface - RestAPI

Earlier PowerCLI had 2 main ways of communication with vSphere API:

  • Get-View (SOAP API bindings)
  • Get-CISService (JSON-RPC)

Now PowerCLI API bindings allow you to work vSphere Rest API and provide a practically native interface PowerShell.

The module implementing these functions is called the vSphere Automation API SDK. To start using the features through Rest API automation, you need to download version PowerCLI 12.4 - the package will be called "VMware.Sdk.vSphere." It contains sub-modules for interacting with all Rest APIs that are in VMware vSphere.

Rest API has methods for executing APIs and working with data structures that are used as input parameters for the API. Bindings APIs now provide low-level PowerShell functions to work with all these methods and structures.

The Invoke function is used to execute Rest methods such as GET/PUT/POST and DELETE:

The Initialize function is used to create a data structure that will be passed to the Rest API. For example, creating a "local account" structure looks like this:

$LocalAccountsConfig = Initialize-LocalAccountsConfig -Password 'Tes$TPa$$w0Rd' -Roles 'superAdmin' #Create Account Config

$LocalAccountsCreateRequestBody = Initialize-LocalAccountsCreateRequestBody -Username 'dimilov' -Config $LocalAccountsConfig #Create Account Request Body

Invoke-CreateLocalAccounts -LocalAccountsCreateRequestBody $LocalAccountsCreateRequestBody #Create Local Account

The examples showing Rest API call through PowerCLI were added to the section of documentation vSphere API Documentation. For example, here is the section Create Local Accounts.

VSphere Management Module

The VSphere Management Module is now available to manage the vSphere platform. This is a PowerShell-based module that uses the vSphere Automation API SDK architecture described above. As of September 20, 2021, the module has 6 cmdlets that allow you to manage certificates:

  • Add-VITrustedCertificate
  • Get-VIMachineCertificate
  • Get-VITrustedCertificate
  • New-VIMachineCertificateSigningRequest
  • Remove-VITrustedCertificate
  • Set-VIMachineCertificate

Logo of the PowerCLI

Now he looks like this:

Other changes

  • Support for enhanced VMC SDDC parameters
  • The Copy-DatastoreItem cmdlet now supports upload/download of VMDK files with. storages vSAN
  • The Bidding API for VMware Horizon now supports all Horizon 8.3 APIs (aka 2106).[2]

2020: PowerCLI 12.0

On April 24, 2020, the company VMware updated its main management framework virtual infrastructure using team scripts PowerShell to version PowerCLI 12.0.

Changes and additions to VMware PowerCLI 12.0 noted by the developer:

  • Added cmdlets to manage the ESXi host network. Back in vSphere 6.0, support for ESXi host network stacks appeared. It allows you to assign different gateways to VMkernel adapters for traffic routing purposes. Through PowerCLI, you can use ESXCLI or API to manage this functionality using the Get-VMHostNetworkStack and Set-VMHostNetworkStack cmdlets. The parameter presented is called "NetworkStack," it was added to the cmdlet New-VMHostNetworkAdapter:

PowerCLI 12.0
  • Cmdlets added to manage HCX solution
  • Cmdlets for namespace management have appeared
  • Trusted Host Services Management Cmdlets
  • Cmdlets for Disk Management of Guest Virtual Machines (VM Guest Disk management)

The guest OS partition can be sealed to a VMDK disk (so far only for Windows systems). This will require vSphere 7 and VMware Tools at least version 11. You can use this feature using the Get-VMGuestDisk cmdlet:

PowerCLI 12.0
  • Cmdlets to manage VMware Cloud on AWS
  • There are cmdlets for vSAN:
    • Get-VsanFileServiceDomain
    • New-VsanFileServiceDomain
    • Set-VsanFileServiceDomain
    • Remove-VsanFileServiceDomain
    • New-VsanFileServiceIpConfig
    • Get-VsanFileShare
    • New-VsanFileShare
    • Set-VsanFileShare
    • Remove-VsanFileShare
    • New-VsanFileShareNetworkPermission
    • Add-VsanFileServiceOvf
    • Get-VsanFileServiceOvfInfo

  • VMware Cloud Services Management Module Available
  • Added support for vSphere 7.0
  • Added support for vRealize Operations 8.0
  • Updated support for License and vROps modules as well as the Open-VMConsoleWindow cmdlet for use on different platforms
  • Move-VM support for opaque networks
  • Added support for latest updates PowerShell 7.0:[3]

PowerCLI 12.0

2019

PowerCLI 11.5

On October 28, 2019, it became known that the company VMware updated its main framework for management virtual infrastructure using scripts - PowerCLI 11.5.

Changes and additions to PowerCLI 11.5 noted by the developer:

  • Cmdlets for managing Content Library. In recent versions of VMware vSphere, the functionality of Content Library has been significantly improved. In PowerCLI 11.5, 8 cmdlets were added, and template support (templates) was added:
    • New-ContentLibraryItem
    • Set-ContentLibraryItem
    • Remove-ContentLibraryItem
    • Export-ContentLibraryItem
    • New-ContentLibrary
    • Set-ContentLibrary
    • Get-ContentLibrary
    • Remove-ContentLibrary

Sample Polling Library Object Content in PowerCLI 11.5
  • Update the vCenter Alarm Management engine. The presented version of the PowerCLI has 6 additional and 3 updated cmdlets for managing alert definitions, triggers, as well as for obtaining data on event types and metrics.
    • Cmdlets appearing:
      • New-AlarmDefinition
      • Remove-AlarmDefinition
      • New-AlarmTrigger
      • Get-AlarmTrigger
      • Get-EventType
      • Get-Metric

    • Updated cmdlets:

      • New-AlarmAction
      • New-AlarmActionTrigger
      • Set-AlarmDefinition

Example of a cmdlet that creates an alert definition in a vCenter
  • Upgrade VMware Cloud on AWS. Previously, the VMware Cloud on AWS (VMC) management module was used as a means of low-level interaction with the VMC infrastructure. In the presented version, this low-level interface was replaced with high-level commands to perform the operations required by the user.

To create an SDDC object, use 1 command instead of 20 lines of code that were required before

Cmdlets that appeared for VMC:

    • Get-VmcSddc
    • Set-VmcSddc
    • New-VmcSddc
    • Remove-VmcSddc
    • Add-VmcSddcHost
    • Remove-VmcSddcHost
    • Get-AwsAccount
    • Get-AwsVpcSubnet

  • Updated VMware Core module. Here, the functionality associated with tags was refined. The Get-Tag cmdlet and the Tag parameter for Get-VM have been updated, and the Get/Remove-TagAssignment cmdlets have also been updated. In addition, the basic functions have been enriched with some useful functions. For example, when you create a virtual machine from a template using the New-VM cmdlet, you can configure the portgroup through the NetworkName or Portgroup parameters.


In vSphere 6.7, the virtual machine property CreateDate appeared, which is also supported in cmdlets associated with the virtual machine:

The Update-Module -Name PowerCLI command updates the VMware.PowerCLI modules.[4]

PowerCLI 11.4

On August 22, 2019, VMware announced the release of a virtual infrastructure management framework update through PowerShell - VMware PowerCLI 11.4.

Changes and additions to PowerCLI 11.4 noted by the developer:

  • Support for Horizon View 7.9. The Horizon View (VMware.VimAutomation.HorizonView) module has been updated to support VMware Horizon 7.9 capabilities.
  • Updated Storage Module. In PowerCLI 11.4, the storage module was significantly refined to support the latest VMware vSAN 6.7 Update 3 failover storage cluster product. For example, Get/Set-VsanClusterConfiguration cmdlets that support Proactive Rebalance and vSphere Update Manager baseline preference have been updated.

Updated Storage Module in PowerCLI 11.4

According to the developer, three additional cmdlets appeared. The first is Add-VsanObjectToRepairQueue, it can restore objects that are added to the restore queue (previously this function was partially available in cmdlet Repair-VsanObject). The second and third are Get-VsanResyncingOverview and Get-VsanEnterMaintenanceMode, they work with the functions vSAN 6.7 U3.

  • Updated HCX module. 6 cmdlets were added to this module:
    • Get-HCXAppliance-Returns information about the current version of the virtual module and the available versions.
    • It can be used with the New-HCXAppliance cmdlet - it allows you to upgrade the virtual module to one of the available versions.
    • Get-HCXContainer - adds the ability to list containers of type "OrgVdc."
    • Get-HCXNetwork - adds the ability to view 2 types of networks: NsxtSegment and OrgVdcNetwork.
    • New-HCXNetworkExtension - Enables you to work with networks like NsxtSegment.
    • Get-HCXServiceMesh - it has properties that allow you to see the parameters of some services.

Example of using Get-HCXAppliance and Get-HCXServiceMesh cmdlets to view the ServiceStatus property in PowerCLI 11.4

According to the developer, the commandlets of Get-HCXServiceMesh and Get-HCXInterconnectStatus were significantly refined in order to be able to correct the situation with various errors. Also, the DestinationNetworkValue property is displayed correctly in the presented version.

840p

Updating Modules PowerCLI]]

The Update-Module -Name PowerCLI command updates the VMware.PowerCLI modules.[5]

PowerCLI 11.3

On June 23, 2019, VMware announced the release of the updated VMware PowerCLI 11.3 framework.

Changes and additions in version PowerCLI 11.3, marked by the developer:

  • Added 22 cmdlets to manage HCX and SPBM (policy) components storages. Their support was already in version 11.2, but in version 11.3 it expanded. The following cmdlets are available for HCX:
    • Get/New/Remove/Set-HCXComputeProfile
    • Get-HCXInventoryCompute
    • Get-HCXInventoryDatastore
    • Get-HCXInventoryDVS
    • Get-HCXInventoryNetwork
    • Get-HCXNetworkBacking
    • Get/New/Remove/Set-HCXNetworkProfile
    • Get/New/Remove/Set-HCXServiceMesh
    • Get-HCXStorageProfile
    • New-HCXComputeProfileDVS
    • New-HCXComputeProfileNetwork
    • New-HCXServiceMeshDVS

In terms of support for SPBM, the Get-SpbmView cmdlet appeared, which provides direct access API to the storage policy management mechanism. The following example lists available services and interacts with Replication Manager to obtain a set of available methods:

VMware PowerCLI 11.3

Also in PowerCLI 11.3, cmdlets can Get/Set-SpbmEntityConfiguration view or modify SPBM datastore storage policies. Example of a cmdlet to display datastore policy settings:

VMware PowerCLI 11.3
  • Support for vSphere 6.7 Update 2 in VMware.VIM. The latest version of the platform is vSphere fully supported for management through this module.
  • Support for opaque networks in cmdlet Get-VirtualNetwork. These networks appear as a result of working with logical switches in the NSX-T solution. In version PowerCLI 11.2, management of such networks was available only through the direct API, and in version PowerCLI 11.3 you can manage them using a high-level cmdlet:

VMware PowerCLI 11.3
  • Added the ability to create additional types of network adapters. Here, SriovEthernetCard and Vmxnet3Vrdma adapters were added, and PhysicalFunction and DeviceProtocol parameters appeared.
  • Support for high-level conversion of instant clones to regular VMs. Starting with vSphere 6.7, instant clones became available to users in the production environment, but they could only be managed through the API. Using PowerCLI 11.3, you can use the Set-VM cmdlet together with the PromoteDisks parameter, which will make it possible to convert the instant clone machine into a stand-alone VM, which is no longer dependent on the parent, emphasized in VMware.
  • Updated cluster status processing for property SpbmEnabled. The datastore in the cluster does not show SpbmEnabled status because it is always enabled and cannot be disabled by the user.
  • Updated processing of the batch tag binding mode. Tag binding vSphere tags using the cmdlet New-TagAssignment goes on the server side in batch mode, which, according to the developer, gives an increase in performance (from 12 to 18 times):

VMware PowerCLI 11.3

As noted in VMware, the update to version PowerCLI 11.3 should be done using the Update-Module cmdlet[6]

VMware PowerCLI 11.3

PowerCLI 11.2.0

In early March 2019, the company VMware announced the release of an update to its management framework virtual infrastructure PowerCLI 11.2.0.

The module for VMware HCX appeared in PowerCLI 11.2. VMware HCX is a suite of utilities for managing a hybrid environment consisting of cloud resources and an unlimited infrastructure. Using the module for HCX, you can perform vMotion migrations (including batch mode), including very large VMs, support the VM life cycle, and protect data for disaster tolerance, which is duplicated at the site level. In total, 20 cmdlets were added to solve such problems, specified in VMware.

Module for VMware HCX

Added support for NSX-T Policy Services. The NSX-T solution allows you to abstract network management and data center network infrastructure security with policies. NSX-T is also used to ensure the availability of services.

With the Get-NsxtPolicyService cmdlet, you can automate most policy management operations using the standard API. The cmdlet is compatible with NSX-T 2.4, noted in VMware.

Added support for OAuth services to connect to vCenter. In terms of supporting the VMware Cloud on AWS security infrastructure, the presented version of the PowerCLI significantly improved the authentication mechanism. There are 2 cmdlets for authentication and the existing cmdlet has been updated to support the OAuth2 mechanism.

For the VMC cloud module, a special New-VcsOAuthSecurityContext cmdlet has appeared that allows you to use the security context of a user session based on the VMware Cloud on AWS token.

For the Core module, the New-VISamlSecurityContext cmdlet appeared, which allows you to obtain and use the OAuth security context and translate it into the SAML2 context, which is already used to connect to vCenter (Connect-VIServer) and other things. According to information for March 2019, this functionality works only in GovCloud for the government cloud.

Support for Opaque Networks (virtual infrastructure networks that are managed externally by vSphere solutions, such as OpenStack). The Set-NetworkAdapter and Import-VApp cmdlets provide support for Opaque Networks.

Updated Storage cmdlets. The Get-VsanSpaceUsage cmdlet in the presented version has an additional parameter that allows you to return results for a specific storage policy. Also, several parameters from the cmdlet Set-VsanClusterConfiguration (CustomizedSwapObjectEnabled, GuestTrimUnmap, LargeClusterSupported, ObjectRepairTimerMinutes and SiteReadLocalityEnabled) were added to the cmdlet. The cmdlet Test-VsanNetworkPerformance, which has the parameter DurationInSecond, has also been updated (it can control the time of testing the storage performance[7]?

PowerCLI for VMware Cloud on AWS

On January 14, 2019, a preview of PowerCLI for VMware Cloud on AWS technology appeared on the VMware Labs project website, which is an extension of the public cloud PowerCLI framework from Amazon and VMware. The extension is delivered as a separate module PowerCLI (VMware.VimAutomation.VmcPreview) that integrates with the rest of the modules.

PowerCLI for VMware Cloud on AWS

All module commands are generated automatically, as of January 2019 they are in development, so they can be updated and changed, which should be taken into account when developing scenarios. In total, there are 14 high-level cmdlets in the module, such as Get-Organization or Get-Sddc.

You will need PowerCLI 11.0.0 or higher to get started. You can install the module automatically from PowerShell Gallery using the command:

Install-Module -Name VMware.VimAutomation.VmcPreview -RequiredVersion 1.0.0.11171858

After installation, you must first use authentication a token that can be found cloudy VMware Cloud on AWS in the Cloud console under Account:

Connect-Vmc -RefreshToken xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

Next, you need information about your organization:

Get-Organization

Get information about your organization

Using Select-Object, you can filter the output by properties:

Get-Organization|Select-Object -Property Id, DisplayName

Filtering by Properties

You can also obtain an SDDC object using the Organization ID:

Organization ID

Next, you can work with the SDDC object as in a familiar PowerCLI environment, for example, get AWS Region, which Availability Zones are used, NSX information (for example, Manager URL), and vCenter URL:

AWS Region Retrieval

2018: PowerCLI 11.1.0

At the end of December 2018, VMware released an update to its console framework for managing virtual infrastructure - PowerCLI 11.1.0.

PowerCLI 11.1.0

In this update:

1. Site Recovery Manager Module enhancements.

The VMware.VimAutomation.SRM module for PowerCLI now provides multi-platform support for Site Recovery Manager infrastructure management. This module can be used with PowerShell Core on MacOS and Linux platforms. It became one of the specialized modules converted to other platforms. The latest version of Site Recovery Manager 8.1 is also supported.

2. Storage Module Updates.

Storage (VMware.VimAutomation.Storage) has made several bug fixes and improvements. The Get-VsanDisk cmdlet now displays the vSAN disk where the Witness Component is located. Also, the cmdlet Start-SpbmReplicationTestFailover no longer needs the parameter [8]

2017: Versions 6.5.1 and 6.5.2

On August 14, 2017, VMware announced the release of the framework PowerCLI 6.5.2[9].


Changes and additions

  • Parameter InventoryLocation.
    • If you used Destination to move a VM, which took the type of folder, ESXi host, cluster, or resource-pool (one of the values), you can now use the InventoryLocation parameter to specify the direct end position of the VM. This makes it easier to move VMs, for example, between vCenter servers.

  • Use ISO from Content Library.

    • The New-CDDrive cmdlet now has a ContentLibraryIso option that you can use to specify an ISO image in the library.

  • Upgrade of pilot capabilities

    • Set-HardDisk -ZeroOut. This option can be used to fill the disk with zeros when directly accessing the ESXi host.
    • New-HardDisk -AdvancedSetting. Use this option to associate Storage Distributed Resource Scheduler (SDRS) rules.
    • New-VM -AdvancedSetting. Similar to the previous item - required for SDRS rules.
    • Install-VMHostPatch. This cmdlet is experimental.


Changes to PowerCLI 6.5.1

  • AutoLoad PowerShell Modules.
    • Now, after the login and execution of the cmdlet request, all the necessary modules are automatically uploaded.
    • Updated cmdlets for DRS cluster groups and VM/Host rules.

  • Cmdlets Added

    • Get-DRSClusterGroup
    • New-DRSClusterGroup
    • Set-DRSClusterGroup
    • Remove-DRSClusterGroup
    • Get-DRSVMHostRule
    • New-DRSVMHostRule
    • Set-DRSVMHostRule
    • Remove-DRSVMHostRule

  • VMware.VimAutomation.Srm module for SRM management.

    • It is now taken from the main module to a separate module.

  • API Updates

    • The vR Ops (vRealize Operations) and Horizon (Horizon View 7.1 API) modules have been upgraded to work with external products.

  • Cmdlets for iSCSI vSAN

    • There are cmdlets to manage initiators and targets iSCSI:
      • Get-VsanIscsiInitiatorGroup
      • New-VsanIscsiInitiatorGroup
      • Set-VsanIscsiInitiatorGroup
      • Remove-VsanIscsiInitiatorGroup
      • Get-VsanIscsiTarget
      • New-VsanIscsiTarget
      • Set-VsanIscsiTarget
      • Remove-VsanIscsiTarget
      • Get-VsanIscsiInitiatorGroupTargetAssociation
      • New-VsanIscsiInitiatorGroupTargetAssociation
      • Remove-VsanIscsiInitiatorGroupTargetAssociation
      • Get-VsanIscsiLun
      • New-VsanIscsiLun
      • Set-VsanIscsiLun
      • Remove-VsanIscsiLun
      • Get-VsanStat
      • Start-VsanDiskFormatUpdate
      • Get-VSANView

Storage also received cmdlets for storage policy based management (SPBM):

  • Start-SpbmReplicationPromote
  • Start-SpbmReplicationTestFailover
  • Stop-SpbmReplicationTestFailover

2014: 5.5 R2 Release

On March 12, 2014, VMware announced the release of a new version of the add-on - vSphere PowerCLI 5.5 R2.

File:Powercli.png


Description

This release implements:

  • Manage the vCenter Site Recovery Manager solution through a public API.
  • Create/delete tags and tag categories.
  • obtaining status and setting Enhanced vMotion Compatibility (EVC) mode for clusters.
  • Manage security policies for common virtual switches (vSwitch) and their port groups.
  • Windows PowerShell 4.0 support.
  • support for vSphere servers with IPv6 configured.
  • Specifies the priority of the VM migration (VMotionPriority for [10] Move-VM [10]).
  • using Hard Disk as a RelatedObject in the Get-Datastore method.
  • Get-Datastore cmdlet allows you to filter output by cluster.
  • Get-Stat and Get-StatType cmdlets now work with all types, which allows you to collect more statistical information.
  • added support for e1000e network adapters.
  • ability to specify all values in the DiskStorageFormat parameter when cloning a virtual machine.
  • 64-bit OS support for New-OSCustomizationSpec and Set-OSCustomizationSpec methods.
  • The VMGuest object ToolsVersion property shows the tool version as a string.
  • the ability to use the virtual portgroup object as a RelatedObject in the Get-VirtualSwitch and Get-DVSwitch methods.
  • obtaining a list of VM sorted by virtual switches.
  • Various bug fixes and cmdlet performance improvements that can be viewed in the change log.

With VMware SRM via PowerCLI, you can:

  • configuring VM replication to a remote site.
  • connection to the vCenter Site Recovery Manager (SRM) server.
  • Report virtual machines and the groups they belong to.
  • Report all SRM protected virtual machines.

The updated product is available for download on the vendor's website.

Notes