Updating the vCenter Server Appliance (VCSA) with PowerCLI - Revisited

Published on June 22, 2020 under VMware · Tagged PowerCLI, vSphere 6.7, REST API, vCenter Server, vSphere 7.0, Powershell and vSphere · Read in about 4 min (679 words)

In previous blogs, I covered how to update your VCSA using PowerCLI and with Postman. I also had multiple code sessions at VMworld 2019 where I got great feedback on the module. It’s been a while since I have looked at the module, and time has passed so I thought it was due for an update. The module will no longer need to be manually imported, it is now located in the Powershell Gallery!

VMware {code} Power Session Covering the Module!

Introduction

Using tools such as Postman can make it utilizing API’s a bit easier, but you still need to be familiar with a separate tool or UI. I was able to develop my own version and build my first Powershell Module that you can use to patch the VCSA in a simple method. Some of the function names below may not be 100% exact and this is due to the accepted verbs for Powershell. If you have further recommendations I would be happy to entertain changing the Powershell verbage.

Use Cases

Why would you want to use a Powershell module such as this? Well this tool can support multiple vCenter Servers. So here are a few ideas…,

  • Modify a Custom URL Repository Across all vCenter Servers in your Environment
  • Stage Patches across all vCenter Servers in your Environment.
  • Patch Multiple Servers Simultaneously

Exploring the Powershell Module Functions

As of current, the Powershell module currently has 12 Functions.

  • Copy-VCSAUpdate
  • Get-VCSAUpdate
  • Get-VCSAUpdateDetail
  • Get-VCSAUpdatePolicy
  • Set-VCSAUpdatePolicy
  • Get-VCSAUpdateStaged
  • Get-VCSAUpdateStatus
  • Remove-VCSAUpdate
  • Start-VCSAUpdateInstall
  • Start-VCSAUpdatePrecheck
  • Start-VCSAUpdateStageandInstall
  • Start-VCSAUpdateValidate
  • Stop-VCSAUpdate

Copy-VCSAUpdate

Copy-VCSAUpdate is the command you will use when you want to manually stage the update.

Example:

Get-VCSAUpdate

Get-VCSAUpdate is the command you will use when you want to wish to check for new updates. There is an optional Parameter for Source, “Local” or “Online”, if no parameter is chosen it will default to Online.

Examples:

Get-VCSAUpdateDetail

Get-VCSAUpdateDetail is the command you will use when you want to wish to get more details about a specific update. There is a mandatory parameter for Version.

Example:

Get-VCSAUpdatePolicy

Get-VCSAUpdatePolicy is the command you will use when you want to wish to get information about the current appliance update settings.

Example:

Set-VCSAUpdatePolicy

Set-VCSAUpdatePolicy is the command you will use when you want to wish to set information for the current appliance update settings.

Example:

Get-VCSAUpdateStaged

Get-VCSAUpdateStaged is the command you will use when you want to wish to get information about the current staged update.

Example:

Get-VCSAUpdateStatus

Get-VCSAUpdateStaged is th e command you will use when you want to wish to get information about the current update status. This command can be used to get status of staged update, install update or any other update status.

Example:

Remove-VCSAUpdate

Remove-VCSAUpdate is the command you will use when you wish to remove a staged update.

Example:

Start-VCSAUpdateInstall

Start-VCSAUpdateInstall is the command you will use when you wish to install a currently staged update. If no update is staged you must use Start-VCSAUpdateStageandInstall

Example:

Start-VCSAUpdatePrecheck

Start-VCSAUpdatePrecheck is the command you will use when you wish to run the built-in update Precheck.

Example:

Start-VCSAUpdateStageandInstall

Start-VCSAUpdateInstall is the command you will use when you wish to install and stage an update.

Example:

Start-VCSAUpdateValidate

Start-VCSAUpdateValidate is the command you will use when you wish validate the current update.

Example:

Stop-VCSAUpdate

Stop-VCSAUpdate is the command you will use when you want to cancel an update task such as staging an update or other task that has a status of cancelable.

Example:

Putting the Powershell Module to Use

This Examples assumes your VCSA has Internet Access and we will update via the Online Repo.

You can access the Powershell Module here on the Powershell Gallery.

Important Note: The code samples included in this module are not supported by VMware. The code included is only provided as sample code for the purpose of demonstrating different tasks using the PowerCLI and the REST API.

Conclusion

I hope this module can be useful for you to get started with updating your VCSA in a more Automated fashion.

If you have any questions feel free to reach out here or on twitter @davidstamen

Share this post
comments powered by Disqus

See Also