Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
EN-000897-00
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, Inc.
TheVMwarevSphereUpdateManagerPowerCLIInstallationandAdministrationGuide,providesinformation
aboutinstallingandusingtheUpdateManagerPowerCLI.TheUpdateManagerPowerCLIcontainscmdlets
formanagingsoftwarepatchesandbaselines,andscanningandremediatingvirtualmachinesandhosts.
Intended Audience
ThisbookisintendedforadministratorswhoneedtoinstallanduseUpdateManagerPowerCLI.
NOTEAllUpdateManagerPowerCLIusersareexpectedtobefamiliarwiththeVMwarevSpherePowerCLI
cmdlets,VMwarevSphereadministration,VMwarevSphereUpdateManager,andtheWindowsoperating
system.FormoreinformationaboutthefunctionalityofUpdateManager,seetheUpdateManager
AdministrationGuide.
Document Feedback
VMwarewelcomesyoursuggestionsforimprovingourdocumentation.Ifyouhavecomments,sendyour
feedbacktodocfeedback@vmware.com.
Support Offerings
TofindouthowVMwaresupportofferingscanhelpmeetyourbusinessneeds,goto
http://www.vmware.com/support/services.
VMware, Inc.
VMware, Inc.
TheVMwarevSphereUpdateManagerPowerCLIprovidesasetofcmdletsfordownloadingsoftware
patches,creatingandmodifyingbaselines,andforscanningandremediatingvirtualmachinesorhosts.These
cmdletsarestoredintheVMware.VumAutomationplugin,andareavailablethroughtheVMwarevSphere
PowerCLIconsole.
Thechapterincludesthefollowingtopics:
InstallingUpdateManagerPowerCLIonpage 7
UsingUpdateManagerPowerCLIonpage 8
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.
Prerequisites
ToinstallanduseUpdateManagerPowerCLI5.1,youmusthavethefollowingsoftwareinstalledonthetarget
machine:
.NET2.0SP1
WindowsPowerShell2.0
VMwarevSpherePowerCLI4.1orlater
NOTEUpdateManagerPowerCLI5.1worksonlywithUpdateManager5.1.
StarttheUpdateManagerPowerCLIinstaller.
ClickNextintheWelcomepagetocontinuewiththeinstallation.
Readandacceptthelicenseagreementterms.
ClickInstall.
ClickFinishtocompletetheinstallationprocess.
GettingStartedwithUpdateManagerPowerCLIonpage 8
ExamplesofUsageofUpdateManagerPowerCLICmdletsonpage 9
NOTEYoucanchecktheUpdateManagerPowerCLIversionbyrunningthefollowingcommand:
Get-PowerCLIVersion
Tofindinformationonaspecificcmdlet,runtheGet-Helpcmdletwiththecmdletname.Forexample:
Get-Help Get-Patch
VMware, Inc.
RunConnect-VIServerandprovidetheserverDNSorIPaddress:
Connect-VIServer 10.23.112.234
Whenprompted,provideausernameandpasswordtoauthenticate.
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
AttachthehostpatchbaselinesstoredintheprovidedvariablestothehostnamedHost:
Attach-Baseline -Baseline $staticBaseline, $criticalPatchBaseline -Entity Host
Detachthetwobaselinesfromthehost:
Detach-Baseline -Baseline $dynamicBaseline, $staticBaseline -Entity Host
VMware, Inc.
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.
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
RetrieveallentitiesintheDatacenterdatacenterandsavetheresultinavariable:
$entities = Get-Inventory -Location Datacenter
Downloadallavailablepatchesandsavetheresultinavariable:
$result = Download-Patch
CheckifnewpatchesaredownloadedandstartscanningtheentitiesinDatacenter:
if ($result.Count > 0) {
Scan-Inventory -Entity $entities
}
12
VMware, Inc.