Currently we have Windows templates that need to be updated regularly. I'm looking for pointers on the best way to handle this - for example:
-Create a script that converts all templates to vms
-Have the script power on the vms
-Have the script run update manager once the vms are powered on
-Have the script power off vms after updates have been applied
-Have the script convert the vms back to templates
Can someone advise on the best way to do this or anything I may not have thought of - thanks
Those are MS patches, Remediate-Inventory only returns what it received back from the patching tool.
Can't you find the cause of the error in the eventlog or the windowsupdate.log of the guest ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
thead moved to VUM PowerCLI Community for better exposure.
(Thanks for moving my thread to a better place)
That is quite easy with PowerCLI
Get-Template | Remediate-Inventory -Baseline (Get-Baseline -Name "Critical VM Patches") -Confirm:$false
The Remediate-Inventory cmdlet can handle templates, it converts them to a VM and back and it will do the power on and off for you.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
great - thanks I'll give it a try
I'm getting an error when I run this that "Remediate-Inventory" is not recognized as the name of a cmdlet, function, script file, [etc. - you know the message]. Are you sure this is the right cmdlet name for this? Thanks
Hello, TheVMinator-
Remediate-Inventory is a cmdlet that is part of the vCenter Update Manager PowerCLI (a.k.a. "VUMPS) package available at http://communities.vmware.com/community/vmtn/vsphere/automationtools/powercli/updatemanager?view=ove....
Install that package, and then be sure to add the PSSnapin that it provides. You can do so as such:
Add-PSSnapin VMware.VumAutomation
(you can, of course, add that line to your PowerShell profile) Add that PSSnapin and then give it a shot.
Is the snapin loaded.
Do a
Get-PSSnapin
Do you see "VMware.VumAutomation" in the list ?
If not, load the snapin with
Add-PSSnapin VMware.VumAutomation
If that doesn't work the installation of the VUM snapin is missing or faulty.
Perhaps try installing it (again).
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I downloaded and installed update manager powercli. Then I ran
add-pssnapin VMware.VumAutomation
The first time I ran it it said
"Add-PSSnapin : A requested PowerCLI component was not found on the local system : VMware.VumAutomation"
I ran the same command a second time, then it said
"Add-PSSnapin : Cannot add Windows PowerShell snap-in VMware.VumAutomation because it is already added. Verify the name of the snap-in and try again"
So then I thought maybe it was installed. But then when I run
get-help remediate-inventory
It says 'cannot find help for topic "remediate-inventory"'
Indicating remediate-inventory still isn't available to it. Any other ideas?
note - when I run
get-pssnapin
it DOES show VMware.VumAutomation in the list.
Thanks
And
Get-PSSnapin -Registered
also shows the snapin ?
From where are you running this ? The PowerCLI prompt ?
Did you stop/start the PowerCLI prompt after the installation ?
What does
Get-PowerCLIVersion
show ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
get-pssnapin -registered
does show VMware.VumAutomation
Get-Powercliversion
shows 4.1 U1
Also here's my powershell info:
$psversiontable
Name Value
---- -----
CLRVersion 2.0.50727.4206
BuildVersion 6.0.6002.18111
PSVersion 2.0
WSManStackVersion 2.0
PSCompatibleVersions {1.0, 2.0}
SerializationVersion 1.1.0.1
PSRemotingProtocolVersion 2.1
I'm afraid to suggest this, but did you already try the Windows solution; a reboot ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Well I definitely wasn't aware that a reboot might be required to add a snap-in. I rebooted and now remediate-inventory is recognized. However, I still have an issue when I actually run the command
get-template | remediate-inventory -baseline (get-baseline -name "Critical VM Patches") -Confirm:$false
I'm getting the error in the screenshot attached
Any more ideas?
No, normally you don't need to reboot, but the funny messages you got seemed to indicate something was wrong.
The problem you are seeing now is most probably related to the Update Manager version your are using (apparently 4.1) and the vCenter and/or ESX(i) server version (looks like that is 4.0).
To work with vSphere 4.0 you would need to install the Update Manager 4.0U1 snapin.
See the 4.1 Release Notes.
Sorry that this seems to become a never-ending story 🙂
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
OK thanks. So I uninstalled power cli update manager 4.1 and reinstalled version 4.0 update 1. But during the installation process it gave me this error:
Error 1722. There is a problem with this Windows Installer Package. A program run as part of the setup did not finish as expected. Contact your support personnel or package vendor. Action VM_RegVumPlugin.BED80AD6_657E_4C5B_A462_A7
Since I my version of PowerCLI was 4.1 I thought maybe it was a conflict between the version of PowerCLI I already had installed and the version of update manager PowerCLI I was attempting to install. So then I tried uninstalling powerCLI 4.1 and reinstalling powerCLI 4.0 so that the version of powerCLI and the version of update manager powerCLI would match. Then I retried installing Update Manager PowerCLI, and it installed and would you believe that now it is working!!! I'm going to hold my breath till I verify it actually installed the updates.
Those are MS patches, Remediate-Inventory only returns what it received back from the patching tool.
Can't you find the cause of the error in the eventlog or the windowsupdate.log of the guest ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
It appears that the install of the vmware update manager itself is complete. As further problems within the OS seem to be a separate issue I'm starting a new thread here: