Sei sulla pagina 1di 12

VMware vSphere Update Manager

PowerCLI Installation and


Administration Guide
Update Manager PowerCLI 5.1

EN-000897-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 20102012 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

VMware, Inc.

Contents

AboutThisBook

InstallingandUsingUpdateManagerPowerCLI

InstallingUpdateManagerPowerCLI 7
SupportedPlatforms 7
Prerequisites 8
InstallUpdateManagerPowerCLI 8
UninstallingUpdateManagerPowerCLI 8
UsingUpdateManagerPowerCLI 8
GettingStartedwithUpdateManagerPowerCLI 8
ConnectingtoavCenterServer 9
ExamplesofUsageofUpdateManagerPowerCLICmdlets 9
CreatingPatchBaselines 9
AttachingandDetachingBaselines 9
ScanningaVirtualMachine 10
StagingPatches 10
RemediatingInventoryObjects 11
DownloadingPatchesandScanningObjects 12

VMware, Inc.

VMware vSphere Update Manager PowerCLI Installation and Administration Guide

VMware, Inc.

About This Book

TheVMwarevSphereUpdateManagerPowerCLIInstallationandAdministrationGuide,providesinformation
aboutinstallingandusingtheUpdateManagerPowerCLI.TheUpdateManagerPowerCLIcontainscmdlets
formanagingsoftwarepatchesandbaselines,andscanningandremediatingvirtualmachinesandhosts.

Intended Audience
ThisbookisintendedforadministratorswhoneedtoinstallanduseUpdateManagerPowerCLI.
NOTEAllUpdateManagerPowerCLIusersareexpectedtobefamiliarwiththeVMwarevSpherePowerCLI
cmdlets,VMwarevSphereadministration,VMwarevSphereUpdateManager,andtheWindowsoperating
system.FormoreinformationaboutthefunctionalityofUpdateManager,seetheUpdateManager
AdministrationGuide.

VMware Technical Publications Glossary


VMwareTechnicalPublicationsprovidesaglossaryoftermsthatmightbeunfamiliartoyou.Fordefinitions
oftermsastheyareusedinVMwaretechnicaldocumentationgotohttp://www.vmware.com/support/pubs.

Document Feedback
VMwarewelcomesyoursuggestionsforimprovingourdocumentation.Ifyouhavecomments,sendyour
feedbacktodocfeedback@vmware.com.

Technical Support and Education Resources


Thefollowingsectionsdescribethetechnicalsupportresourcesavailabletoyou.Toaccessthecurrentversion
ofthisbookandotherbooks,gotohttp://www.vmware.com/support/pubs.

Online and Telephone Support


Touseonlinesupporttosubmittechnicalsupportrequests,viewyourproductandcontractinformation,and
registeryourproducts,gotohttp://www.vmware.com/support.
Customerswithappropriatesupportcontractsshouldusetelephonesupportforthefastestresponseon
priority1issues.Gotohttp://www.vmware.com/support/phone_support.html.

Support Offerings
TofindouthowVMwaresupportofferingscanhelpmeetyourbusinessneeds,goto
http://www.vmware.com/support/services.

VMware, Inc.

VMware vSphere Update Manager PowerCLI Installation and Administration Guide

VMware Professional Services


VMwareEducationServicescoursesofferextensivehandsonlabs,casestudyexamples,andcoursematerials
designedtobeusedasonthejobreferencetools.Coursesareavailableonsite,intheclassroom,andlive
online.Foronsitepilotprograms andimplementationbestpractices,VMwareConsultingServicesprovides
offeringsto helpyouassess,plan,build,andmanageyourvirtualenvironment.Toaccessinformationabout
educationclasses,certificationprograms,andconsultingservices,gotohttp://www.vmware.com/services.

VMware, Inc.

Installing and Using Update Manager


PowerCLI

TheVMwarevSphereUpdateManagerPowerCLIprovidesasetofcmdletsfordownloadingsoftware
patches,creatingandmodifyingbaselines,andforscanningandremediatingvirtualmachinesorhosts.These
cmdletsarestoredintheVMware.VumAutomationplugin,andareavailablethroughtheVMwarevSphere
PowerCLIconsole.
Thechapterincludesthefollowingtopics:

InstallingUpdateManagerPowerCLIonpage 7

UsingUpdateManagerPowerCLIonpage 8

Installing Update Manager PowerCLI


YoucaninstallanduseUpdateManagerPowerCLIonmachinesthathaveVMwarevSpherePowerCLI
installedandhaveaccesstoavCenterServersystem.YoucaninstallUpdateManagerPowerCLIonamachine
thatdoesnothaveUpdateManagerorvCenterServerinstalled.
Thissectionprovidesinformationaboutthefollowingtopics:

SupportedPlatformsonpage 7

Prerequisitesonpage 8

InstallUpdateManagerPowerCLIonpage 8

UninstallingUpdateManagerPowerCLIonpage 8

NOTEToinstallUpdateManagerPowerCLI,youmusthavevSpherePowerCLIinstalledonthetarget
machine.ToobtainthevSpherePowerCLIpackage,gotothevSpherePowerCLIdownloadpage.

Supported Platforms
UpdateManagerPowerCLI5.1issupportedonthe32bitand64bitversionsofthefollowingWindows
operatingsystems:

Windows7

WindowsServer2008

WindowsVista

WindowsXPServicePack2

WindowsServer2003ServicePack2

VMware, Inc.

VMware vSphere Update Manager PowerCLI Installation and Administration Guide

Prerequisites
ToinstallanduseUpdateManagerPowerCLI5.1,youmusthavethefollowingsoftwareinstalledonthetarget
machine:

.NET2.0SP1

WindowsPowerShell2.0

VMwarevSpherePowerCLI4.1orlater

NOTEUpdateManagerPowerCLI5.1worksonlywithUpdateManager5.1.

Install Update Manager PowerCLI


YoucandownloadtheUpdateManagerPowerCLIinstallerpackagefromtheproductlandingpage.
NOTEUpdateManagerPowerCLIisinstalledinthesamelocationasPowerCLI.YoucannotinstallUpdate
ManagerPowerCLIinacustomlocation.
To install the Update Manager PowerCLI
1

StarttheUpdateManagerPowerCLIinstaller.

ClickNextintheWelcomepagetocontinuewiththeinstallation.

Readandacceptthelicenseagreementterms.

ClickInstall.

ClickFinishtocompletetheinstallationprocess.

Uninstalling Update Manager PowerCLI


TouninstalltheUpdateManagerPowerCLIfromyourWindowssystem,youcanusetheAddorRemove
Programsutility.

Using Update Manager PowerCLI


ThissectionexploresthebasicsoftheUpdateManagerPowerCLIcmdletsusage.Itdiscussesthefollowing
topics:

GettingStartedwithUpdateManagerPowerCLIonpage 8

ExamplesofUsageofUpdateManagerPowerCLICmdletsonpage 9

Getting Started with Update Manager PowerCLI


TogetstartedwithUpdateManagerPowerCLI,openthevSpherePowerCLIconsolefromtheWindowsStart
menuorbyclickingthevSpherePowerCLIshortcuticon.
YoucangetalistofallUpdateManagerPowerCLIcmdletsbyrunningtheGet-Commandcommandwiththe
-PSSnapinparameter:
Get-Command -PSSnapin VMware.VumAutomation

NOTEYoucanchecktheUpdateManagerPowerCLIversionbyrunningthefollowingcommand:
Get-PowerCLIVersion

Tofindinformationonaspecificcmdlet,runtheGet-Helpcmdletwiththecmdletname.Forexample:
Get-Help Get-Patch

VMware, Inc.

Installing and Using Update Manager PowerCLI

Connecting to a vCenter Server


ConnecttoavCenterServerthathasaUpdateManagerserverinstalledonit.
To connect to a vCenter Server
1

RunConnect-VIServerandprovidetheserverDNSorIPaddress:
Connect-VIServer 10.23.112.234

Whenprompted,provideausernameandpasswordtoauthenticate.

Examples of Usage of Update Manager PowerCLI Cmdlets


ThefollowingexamplesdemonstratethebasicusageoftheUpdateManagerPowerCLIcmdlets.Theexamples
containvSpherePowerCLIcmdletsforretrievingandmanagingvSphereobjects.Toimplementtheexamples
code,youmusthaveanexistingvSphereinfrastructure.

Creating Patch Baselines


Patchbaselinescanbeappliedtohosts.Dependingonthepatchcriteriayouselect,patchbaselinescanbe
eitherdynamicorfixed(static).Patchdataindynamicbaselineschangesdependingonthecriteriayouspecify
eachtimeUpdateManagerdownloadsnewpatches.Fixedbaselinescontainonlythepatchesyouhave
selected,regardlessofnewpatchdownloads.
To create patch baselines
1

Retrieveallhostpatchesreleasedafter1stJanuary2009forESXproducts,andcreateafixedbaseline
namedStatic Baseline,containingtheretrievedpatches:
$patches = Get-Patch -After "1 Jan 2009" -Product ESX*
$staticBaseline = New-PatchBaseline -Static -Name "Static Baseline" -IncludePatch $patches

CreateacriticaldynamicbaselinenamedDynamic Baselinebyusingafetchallquery:
$criticalPatchBaseline = New-PatchBaseline -Dynamic -Name "Dynamic Baseline"
-SearchPatchSeverity Critical

Createanextensionbaselinethatcontainsallavailableextensions:
$extensions = Get-Patch -BundleType Extension
New-PatchBaseline -Static -Name "Extension Baseline" -Extension -IncludePatch $extensions

Attaching and Detaching Baselines


Attachbaselinestoindividualobjectsandtocontainerobjects,suchasfolders,hosts,clusters,anddatacenters.
Attachingabaselinetoacontainerobjecttransitivelyattachesthebaselinetoallobjectsinthecontainer.
To attach and detach baselines
1

AttachthehostpatchbaselinesstoredintheprovidedvariablestothehostnamedHost:
Attach-Baseline -Baseline $staticBaseline, $criticalPatchBaseline -Entity Host

Detachthetwobaselinesfromthehost:
Detach-Baseline -Baseline $dynamicBaseline, $staticBaseline -Entity Host

VMware, Inc.

VMware vSphere Update Manager PowerCLI Installation and Administration Guide

Scanning a Virtual Machine


Scanavirtualmachineagainstthebaselinesattachedtoitorinheritedbyitsparentobject.
To create a task for scanning a virtual machine
1

InitializescanningonavirtualmachinenamedVMagainstbaselinescontainingvirtualmachinehardware
upgradesandVMwareToolsupgrades:
$task = Scan-Inventory -Entity VM -UpdateType VmHardwareUpgrade, VmToolsUpgrade -RunAsync

Thecommandinitializesataskontheserver,returnsasnapshotobjectoftheinitialstateofthetask,and
savesitinthe$taskvariable.
2

Viewtheinitialstatusofthescanningtask:
$task

NOTEThetaskobjectisnotupdatedwiththeactualstateofthetaskprocessrunningontheserver.Even
afterthetaskiscompleted,the$task variablevalueisrunning.Toviewtheactualstatusofthetasks
runningontheserver,usetheGet-Taskcmdlet.
3

(Optional)RuntheWait-Task cmdlettowatchonlinetheprocessprogressandwaitforthetaskto
completebeforerunningothercommands:
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

RetrievethecompliancestatuseswiththevalueUnknownforthebaselinesattachedtotheVMvirtual
machineandstoretheminavariable:
$statuses = Get-Compliance -Entity VM -ComplianceStatus Unknown

VerifywhetherthevirtualmachinehasatleastonebaselinewithUnknowncompliancestatusattachedto
itandstartascan:
if ($statuses.Count -gt 0) {
Scan-Inventory -Entity VM -RunAsync"
}

Staging Patches
StagingallowsyoutodownloadpatchesandextensionsfromtheUpdateManagerservertotheESX/ESXi
hosts,withoutapplyingthepatchesandextensionsimmediately.
To stage patches for a virtual machine host
1

Retrieveahostandassignittoavariable:
$host = Get-VMHost -Name 10.23.112.233

Stagethepatchesforupgradingthehost:
Stage-Patch -Entity $host

NOTEStagingcanbeperformedonlyforhosts,clusters,anddatacenters.

10

VMware, Inc.

Installing and Using Update Manager PowerCLI

Remediating Inventory Objects


Youcanremediatevirtualmachines,virtualappliances,clusters,andhosts.
To remediate a virtual machine
1

RetrieveallbaselinesattachedtotheVMvirtualmachine:
$baselines = Get-Baseline Entity VM

Remediatethevirtualmachine:
Remediate-Inventory Entity VM Baseline $baselines

To upgrade virtual machine hardware and VMware Tools for all virtual machines in a datacenter
1

RetrieveallvirtualmachinesintheDatacenterdatacenter:
$vms = Get-VM -Location Datacenter

Retrieveallvirtualmachineupgradebaselines:
$ugradeBaselines = Get-Baseline -TargetType VM -BaselineType Upgrade

Remediatetheallvirtualmachinesagainstthevirtualmachineupgradebaselines:
foreach ($vm in $vms) {
Remediate-Inventory -Entity $vm -Baseline $upgradeBaselines
}

To remediate a cluster
1

RetrieveallbaselinesattachedtotheClustercluster:
$baselines = Get-Baseline Entity Cluster

Remediatethecluster:
Remediate-Inventory Entity Cluster Baseline $baselines
-ClusterDisableDistributedPowerManagement ClusterDisableHighAvailability
-ClusterDiabelFaultTolerance

NOTEBeforeremediation,youmusttemporarilydisabletheDistributedPowerManagement(DPM),High
Availability(HA)admissioncontrol,andFaultTolerance(FT)featuresoftheclustersyouwanttoremediate.
Afterremediation,UpdateManagerautomaticallyreenablesthedisabledfeatures.
To remediate a host
1

RetrieveallbaselinesattachedtotheHosthost:
$baselines = Get-Baseline Entity Host

Remediatethehost:
Remediate-Inventory Entity Host Baseline $baselines HostFailureAction Retry
HostNumberOfRetries 2 -HostDisableMediaDevices $true

NOTEWhenremediatingahost,youcanconfigurethemaintenancemodesettings.Youcantemporarily
disableanyremovablemediadevicesthatmightpreventthehostfromenteringmaintenancemodeaswell.

VMware, Inc.

11

VMware vSphere Update Manager PowerCLI Installation and Administration Guide

Downloading Patches and Scanning Objects


Youcandownloadpatchesfrompreviouslydefinedlocation.
To start a scan for all entities in a datacenter if new patches are downloaded
1

RetrieveallentitiesintheDatacenterdatacenterandsavetheresultinavariable:
$entities = Get-Inventory -Location Datacenter

Downloadallavailablepatchesandsavetheresultinavariable:
$result = Download-Patch

CheckifnewpatchesaredownloadedandstartscanningtheentitiesinDatacenter:
if ($result.Count > 0) {
Scan-Inventory -Entity $entities
}

12

VMware, Inc.

Potrebbero piacerti anche