VMware vsphere Update Manager PowerCLI Installation and Administration Guide Update Manager PowerCLI 6.0 EN

Similar documents
vcenter Update Manager PowerCLI Installation and Administration Guide vcenter Update Manager PowerCLI 4.1 EN

vsphere PowerCLI Installation Guide VMware vsphere PowerCLI 4.1 Update 1 EN

Lifecycle Manager User's Guide

Using the vcenter Orchestrator Plug-In for vcenter Update Manager

VMware vcenter Configuration Manager and VMware vcenter Application Discovery Manager Integration Guide

Request Manager User's Guide

VMware View Upgrade Guide

VMware Infrastructure 3 Primer Update 2 and later for ESX Server 3.5, ESX Server 3i version 3.5, VirtualCenter 2.5

vcenter Chargeback User s Guide

VMware vcenter AppSpeed User s Guide AppSpeed 1.0 EN

vcenter CapacityIQ Installation Guide

vsphere Upgrade Guide

VMware vcenter Discovered Machines Import Tool User's Guide Version for vcenter Configuration Manager 5.6

PostgreSQL Solution 1.1

vsphere Guest Programming Guide VMware vsphere Guest SDK 4.0

Installing and Configuring vcenter Multi-Hypervisor Manager

Installing and Administering VMware vsphere Update Manager. Update 2 VMware vsphere 5.5 vsphere Update Manager 5.5

vcenter CapacityIQ Installation Guide

Getting Started with ESXi Embedded

VMware vcenter AppSpeed Installation and Upgrade Guide AppSpeed 1.2

vrealize Operations Compliance Pack for PCI

vsphere Update Manager Installation and Administration Guide 17 APR 2018 VMware vsphere 6.7 vsphere Update Manager 6.7

Installing and Configuring vcenter Support Assistant

Reconfiguring VMware vsphere Update Manager. 17 APR 2018 VMware vsphere 6.7 vsphere Update Manager 6.7

IT Systems Integration

Reconfiguring VMware vsphere Update Manager. Update 1 VMware vsphere 6.5 vsphere Update Manager 6.5

Installing and Configuring vcloud Connector

VMware vrealize Configuration Manager Backup and Disaster Recovery Guide vrealize Configuration Manager 5.8

VMware vcenter Configuration Manager Administration Guide vcenter Configuration Manager 5.7

vsphere Datacenter Administration Guide

VMware Skyline Collector Installation and Configuration Guide. VMware Skyline 1.4

QuickStart Guide vcenter Server Heartbeat 5.5 Update 1 EN

Using vrealize Operations Tenant App as a Service Provider

Application Discovery Manager User s Guide vcenter Application Discovery Manager 6.2.2

vsphere Basic System Administration

vsphere Basic System Administration

Virtual Infrastructure Web Access Administrator s Guide Update 2 and later for ESX Server 3.5 and VirtualCenter 2.5

Using the vcenter Orchestrator Perspectives Plug-In

Developing and Deploying vsphere Solutions, vservices, and ESX Agents

Compatibility Matrixes for VMware vcenter Site Recovery Manager 4.0 and Later

Upgrade Guide. vcloud Availability for vcloud Director 2.0

vrealize Network Insight Installation Guide

VMware vfabric Data Director Installation Guide

vcenter Server Installation and Setup Modified on 11 MAY 2018 VMware vsphere 6.7 vcenter Server 6.7

vsphere Availability Guide

Getting Started with ESX Server 3i Installable Update 2 and later for ESX Server 3i version 3.5 Installable and VirtualCenter 2.5

VMware vsphere 5.0 Evaluation Guide

VMware vfabric Data Director Installation Guide

vshield Quick Start Guide

VMware App Volumes Installation Guide. VMware App Volumes 2.13

vcenter Orchestrator Installation and Configuration Guide

Installing vrealize Network Insight. VMware vrealize Network Insight 3.3

Infrastructure Navigator User's Guide

Installing vrealize Network Insight

What Is New in VMware vcenter Server 4 W H I T E P A P E R

vsphere Client Hardware Health Monitoring VMware vsphere 4.1

vcenter Server Heartbeat Administrator's Guide VMware vcenter Server Heartbeat 6.6 Update 2

vsphere Upgrade Update 1 Modified on 4 OCT 2017 VMware vsphere 6.5 VMware ESXi 6.5 vcenter Server 6.5

Installing and Configuring vcloud Connector

Deploying VMware Identity Manager in the DMZ. JULY 2018 VMware Identity Manager 3.2

VMWARE VSPHERE FEATURE COMPARISON

vsphere SDK for Perl Installation Guide vsphere 4.0 EN

vcenter Orchestrator Administration Guide

Configuration Maximums VMware vsphere 5.0

vcenter Chargeback API Programming Guide vcenter Chargeback 1.0.1

Virtual Infrastructure Web Access Administrator s Guide ESX Server 3.0 and VirtualCenter 2.0

VMware Skyline Collector Installation and Configuration Guide. VMware Skyline Collector 2.0

Using vrealize Operations Tenant App for vcloud Director as a Tenant Admin

Site Recovery Manager Administration. Site Recovery Manager 6.1

VMware vrealize Operations Federation Management Pack 1.0. vrealize Operations Manager

vsphere Web Client Extensions Programming Guide vsphere 5.1

Getting Started with ESX Server 3i Embedded ESX Server 3i version 3.5 Embedded and VirtualCenter 2.5

VMware vsphere Customized Corporate Agenda

vsphere Virtual Machine Administration

Deploying VMware Identity Manager in the DMZ. SEPT 2018 VMware Identity Manager 3.3

IaaS Integration for Multi-Machine Services

vrealize Production Test Upgrade Assessment Guide

VMware vsphere. Administration VMware Inc. All rights reserved

vcenter Support Assistant User's Guide

vrealize Network Insight Installation Guide

vrealize Suite Lifecycle Manager 1.0 Installation and Management vrealize Suite 2017

VMware vrealize Configuration Manager SQL Migration Helper Tool User's Guide vrealize Configuration Manager 5.8

vrealize Operations Management Pack for vsan 1.0 Guide

vcenter Support Assistant User's Guide

VMware vrealize Operations for Horizon Installation

Programming Guide Guest SDK 3.5

IaaS Integration for Multi- Machine Services. vrealize Automation 6.2

vrealize Operations Management Pack for NSX for vsphere 3.5 Release Notes

Administering Cloud Pod Architecture in Horizon 7. Modified on 4 JAN 2018 VMware Horizon 7 7.4

vsphere Upgrade Update 2 Modified on 4 OCT 2017 VMware vsphere 6.0 VMware ESXi 6.0 vcenter Server 6.0

vrealize Infrastructure Navigator Installation and Configuration Guide

Developing and Deploying vsphere Solutions, vservices, and ESX Agents

Using the vcenter Orchestrator Plug-In for vcloud Director 1.0

Using the vrealize Orchestrator Operations Client. vrealize Orchestrator 7.5

Administration Guide vshield Zones 1.0 EN

Site Recovery Manager Administration. Site Recovery Manager 6.0

VMware vrealize Operations for Horizon Installation. VMware vrealize Operations for Horizon 6.3

VMware Horizon Migration Tool User Guide

vcenter Operations Manager for Horizon View Administration

Using the vcenter Orchestrator SOAP Plug-In 1.0.1

Transcription:

VMware vsphere Update Manager PowerCLI Installation and Administration Guide Update Manager PowerCLI 6.0 EN-001579-00

VMware vsphere Update Manager PowerCLI Installation and Administration Guide 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: docfeedback@vmware.com Copyright 1998 2015 VMware, Inc. All rights reserved. This product is protected by U.S. and international copyright and intellectual property laws. VMware products are covered by one or more patents listed at http://www.vmware.com/go/patents. VMware is a registered trademark or trademark of VMware, Inc. in the United States and/or other jurisdictions. All other marks and names mentioned herein may be trademarks of their respective companies. VMware, Inc. 3401 Hillview Ave. Palo Alto, CA 94304 www.vmware.com 2 VMware, Inc.

Contents About This Book 5 Installing and Using Update Manager PowerCLI 7 Installing Update Manager PowerCLI 7 Supported Platforms 7 Prerequisites 8 Install Update Manager PowerCLI 8 Uninstalling Update Manager PowerCLI 8 Using Update Manager PowerCLI 8 Getting Started with Update Manager PowerCLI 8 Connecting to a vcenter Server 9 Examples of Usage of Update Manager PowerCLI Cmdlets 9 Creating Patch Baselines 9 Attaching and Detaching Baselines 9 Scanning a Virtual Machine 10 Staging Patches 10 Remediating Inventory Objects 11 Downloading Patches and Scanning Objects 12 VMware, Inc. 3

VMware vsphere Update Manager PowerCLI Installation and Administration Guide 4 VMware, Inc.

About This Book The VMware vsphere Update Manager PowerCLI Installation and Administration Guide, provides information about installing and using the Update Manager PowerCLI. The Update Manager PowerCLI contains cmdlets for managing software patches and baselines, and scanning and remediating virtual machines and hosts. Intended Audience This book is intended for administrators who need to install and use Update Manager PowerCLI. NOTE All Update Manager PowerCLI users are expected to be familiar with the VMware vsphere PowerCLI cmdlets, VMware vsphere administration, VMware vsphere Update Manager, and the Windows operating system. For more information about the functionality of Update Manager, see the Update Manager Administration Guide. VMware Technical Publications Glossary VMware Technical Publications provides a glossary of terms that might be unfamiliar to you. For definitions of terms as they are used in VMware technical documentation go to http://www.vmware.com/support/pubs. Document Feedback VMware welcomes your suggestions for improving our documentation. If you have comments, send your feedback to docfeedback@vmware.com. Technical Support and Education Resources The following sections describe the technical support resources available to you. To access the current version of this book and other books, go to http://www.vmware.com/support/pubs. Online and Telephone Support To use online support to submit technical support requests, view your product and contract information, and register your products, go to http://www.vmware.com/support. Customers with appropriate support contracts should use telephone support for the fastest response on priority 1 issues. Go to http://www.vmware.com/support/phone_support.html. Support Offerings To find out how VMware support offerings can help meet your business needs, go to http://www.vmware.com/support/services. VMware, Inc. 5

VMware vsphere Update Manager PowerCLI Installation and Administration Guide VMware Professional Services VMware Education Services courses offer extensive hands-on labs, case study examples, and course materials designed to be used as on-the-job reference tools. Courses are available onsite, in the classroom, and live online. For onsite pilot programs and implementation best practices, VMware Consulting Services provides offerings to help you assess, plan, build, and manage your virtual environment. To access information about education classes, certification programs, and consulting services, go to http://www.vmware.com/services. 6 VMware, Inc.

Installing and Using Update Manager PowerCLI The VMware vsphere Update Manager PowerCLI provides a set of cmdlets for downloading software patches, creating and modifying baselines, and for scanning and remediating virtual machines or hosts. These cmdlets are stored in the VMware.VumAutomation plug-in, and are available through the VMware vsphere PowerCLI console. The chapter includes the following topics: Installing Update Manager PowerCLI on page 7 Using Update Manager PowerCLI on page 8 Installing Update Manager PowerCLI You can install and use Update Manager PowerCLI on machines that have VMware vsphere PowerCLI installed and have access to a vcenter Server system. You can install Update Manager PowerCLI on a machine that does not have Update Manager or vcenter Server installed. This section provides information about the following topics: Supported Platforms on page 7 Prerequisites on page 7 Install Update Manager PowerCLI on page 8 Uninstalling Update Manager PowerCLI on page 8 NOTE To install Update Manager PowerCLI, you must have vsphere PowerCLI installed on the target machine. To obtain the vsphere PowerCLI package, go to the vsphere PowerCLI download page. Supported Platforms Update Manager PowerCLI 6.0 is supported on the 64-bit versions of the following Windows operating systems: Windows 8.1 Windows 7 Service Pack 1 Windows Server 2012 R2 Windows Server 2008 R2 Service Pack 1 Prerequisites To install and use Update Manager PowerCLI 6.0, you must have the following software installed on the target machine: VMware, Inc. 7

VMware vsphere Update Manager PowerCLI Installation and Administration Guide.NET 4.0 or 4.5.x Windows PowerShell 3.0 or 4.0 VMware vsphere PowerCLI 6.0 R1 or later NOTE Update Manager PowerCLI 6.0 works only with Update Manager 6.0. Install Update Manager PowerCLI You can download the Update Manager PowerCLI installer package from the product landing page. NOTE Update Manager PowerCLI is installed in the same location as PowerCLI. You cannot install Update Manager PowerCLI in a custom location. To install the Update Manager PowerCLI 1 Start the Update Manager PowerCLI installer. 2 Click Next in the Welcome page to continue with the installation. 3 Read and accept the license agreement terms. 4 Click Install. 5 Click Finish to complete the installation process. Uninstalling Update Manager PowerCLI To uninstall the Update Manager PowerCLI from your Windows system, you can use the Add or Remove Programs utility. Using Update Manager PowerCLI This section explores the basics of the Update Manager PowerCLI cmdlets usage. It discusses the following topics: Getting Started with Update Manager PowerCLI on page 8 Examples of Usage of Update Manager PowerCLI Cmdlets on page 9 Getting Started with Update Manager PowerCLI To get started with Update Manager PowerCLI, open the vsphere PowerCLI console from the Windows Start menu or by clicking the vsphere PowerCLI shortcut icon. You can get a list of all Update Manager PowerCLI cmdlets by running the Get-Command command with the -PSSnapin parameter: Get-Command -PSSnapin VMware.VumAutomation NOTE You can check the Update Manager PowerCLI version by running the following command: Get-PowerCLIVersion To find information on a specific cmdlet, run the Get-Help cmdlet with the cmdlet name. For example: Get-Help Get-Patch 8 VMware, Inc.

Installing and Using Update Manager PowerCLI Connecting to a vcenter Server Connect to a vcenter Server that has a Update Manager server installed on it. To connect to a vcenter Server 1 Run Connect-VIServer and provide the server DNS or IP address: Connect-VIServer 10.23.112.234 2 When prompted, provide a user name and password to authenticate. Examples of Usage of Update Manager PowerCLI Cmdlets The following examples demonstrate the basic usage of the Update Manager PowerCLI cmdlets. The examples contain vsphere PowerCLI cmdlets for retrieving and managing vsphere objects. To implement the examples code, you must have an existing vsphere infrastructure. Creating Patch Baselines Patch baselines can be applied to hosts. Depending on the patch criteria you select, patch baselines can be either dynamic or fixed (static). Patch data in dynamic baselines changes depending on the criteria you specify each time Update Manager downloads new patches. Fixed baselines contain only the patches you have selected, regardless of new patch downloads. To create patch baselines 1 Retrieve all host patches released after 1st January 2009 for ESX products, and create a fixed baseline named Static Baseline, containing the retrieved patches: $patches = Get-Patch -After "1 Jan 2009" -Product ESX* $staticbaseline = New-PatchBaseline -Static -Name "Static Baseline" -IncludePatch $patches 2 Create a critical dynamic baseline named Dynamic Baseline by using a fetch-all query: $criticalpatchbaseline = New-PatchBaseline -Dynamic -Name "Dynamic Baseline" -SearchPatchSeverity Critical 3 Create an extension baseline that contains all available extensions: $extensions = Get-Patch -BundleType Extension New-PatchBaseline -Static -Name "Extension Baseline" -Extension -IncludePatch $extensions Attaching and Detaching Baselines Attach baselines to individual objects and to container objects, such as folders, hosts, clusters, and datacenters. Attaching a baseline to a container object transitively attaches the baseline to all objects in the container. To attach and detach baselines 1 Attach the host patch baselines stored in the provided variables to the host named Host: Attach-Baseline -Baseline $staticbaseline, $criticalpatchbaseline -Entity Host 2 Detach the two baselines from the host: Detach-Baseline -Baseline $dynamicbaseline, $staticbaseline -Entity Host VMware, Inc. 9

VMware vsphere Update Manager PowerCLI Installation and Administration Guide Scanning a Virtual Machine Scan a virtual machine against the baselines attached to it or inherited by its parent object. To create a task for scanning a virtual machine 1 Initialize scanning on a virtual machine named VM against baselines containing virtual machine hardware upgrades and VMware Tools upgrades: $task = Scan-Inventory -Entity VM -UpdateType VmHardwareUpgrade, VmToolsUpgrade -RunAsync The command initializes a task on the server, returns a snapshot object of the initial state of the task, and saves it in the $task variable. 2 View the initial status of the scanning task: $task NOTE The task object is not updated with the actual state of the task process running on the server. Even after the task is completed, the $task variable value is running. To view the actual status of the tasks running on the server, use the Get-Task cmdlet. 3 (Optional) Run the Wait-Task cmdlet to watch online the process progress and wait for the task to complete before running other commands: Wait-Task -Task $task To verify whether a virtual machine has at least one baseline with Unknown compliance status attached to it and start a scan 1 Retrieve the compliance statuses with the value Unknown for the baselines attached to the VM virtual machine and store them in a variable: $statuses = Get-Compliance -Entity VM -ComplianceStatus Unknown 2 Verify whether the virtual machine has at least one baseline with Unknown compliance status attached to it and start a scan: if ($statuses.count -gt 0) { Scan-Inventory -Entity VM -RunAsync" } Staging Patches Staging allows you to download patches and extensions from the Update Manager server to the ESX/ESXi hosts, without applying the patches and extensions immediately. To stage patches for a virtual machine host 1 Retrieve a host and assign it to a variable: $host = Get-VMHost -Name 10.23.112.233 2 Stage the patches for upgrading the host: Stage-Patch -Entity $host NOTE Staging can be performed only for hosts, clusters, and datacenters. 10 VMware, Inc.

Installing and Using Update Manager PowerCLI Remediating Inventory Objects You can remediate virtual machines, virtual appliances, clusters, and hosts. To remediate a virtual machine 1 Retrieve all baselines attached to the VM virtual machine: $baselines = Get-Baseline Entity VM 2 Remediate the virtual machine: Remediate-Inventory Entity VM Baseline $baselines To upgrade virtual machine hardware and VMware Tools for all virtual machines in a datacenter 1 Retrieve all virtual machines in the Datacenter datacenter: $vms = Get-VM -Location Datacenter 2 Retrieve all virtual machine upgrade baselines: $ugradebaselines = Get-Baseline -TargetType VM -BaselineType Upgrade 3 Remediate the all virtual machines against the virtual machine upgrade baselines: foreach ($vm in $vms) { Remediate-Inventory -Entity $vm -Baseline $upgradebaselines } To remediate a cluster 1 Retrieve all baselines attached to the Cluster cluster: $baselines = Get-Baseline Entity Cluster 2 Remediate the cluster: Remediate-Inventory Entity Cluster Baseline $baselines -ClusterDisableDistributedPowerManagement ClusterDisableHighAvailability -ClusterDiabelFaultTolerance NOTE Before remediation, you must temporarily disable the Distributed Power Management (DPM), High Availability (HA) admission control, and Fault Tolerance (FT) features of the clusters you want to remediate. After remediation, Update Manager automatically re-enables the disabled features. To remediate a host 1 Retrieve all baselines attached to the Host host: $baselines = Get-Baseline Entity Host 2 Remediate the host: Remediate-Inventory Entity Host Baseline $baselines HostFailureAction Retry HostNumberOfRetries 2 -HostDisableMediaDevices $true NOTE When remediating a host, you can configure the maintenance mode settings. You can temporarily disable any removable media devices that might prevent the host from entering maintenance mode as well. VMware, Inc. 11

VMware vsphere Update Manager PowerCLI Installation and Administration Guide Downloading Patches and Scanning Objects You can download patches from previously defined location. To start a scan for all entities in a datacenter if new patches are downloaded 1 Retrieve all entities in the Datacenter datacenter and save the result in a variable: $entities = Get-Inventory -Location Datacenter 2 Download all available patches and save the result in a variable: $result = Download-Patch 3 Check if new patches are downloaded and start scanning the entities in Datacenter: if ($result.count > 0) { Scan-Inventory -Entity $entities } 12 VMware, Inc.