Last post, I added "Windows Server Update Service" server to "System Center Virtual Machine Manager 2012 R2". In this port, I'd like to create update baselines and apply it to Windows Servers.
Goal
- Create "Update Baselines" by VMM console and PowerShell
Lab environment
The lab environment is based on "Installing System Center Virtual Machine Manager 2012 R2 in Windows Server 2012 R2" and "Adding Windows Server Update Service for System Virtual Machine Manager 2012 R2 environment".
Prerequisites
- Add "Windows Server 2012" into the products of Update Server, SUS01
Lab
Create "Update Baselines"
1. On VMM01, log in as VMMAdmin.
2. Launch "Virtual Machine Manager Console".
3. Select "Use current Microsoft Windows session identity" option, click "Connect".
4. On "Virtual Machine Manager" select "Library".
5. Select "Update Baselines".
By default, there are 2 sample Baselines which are related to "Critical Updates" and "Security Updates" in VMM console. All "Critical Updates" are added into "Sample Baseline for Critical Updates" and all "Security Updates" are added into "Sample Baseline for Security Updates".
6. Right-click "Update Baselines", select "Create Baseline".
7. On "General" window, next to "Name", enter "Critical Updates for Hyper-V hosts 2012 R2".
8. Click "Next".
9. On "Updates" window, click "Add".
10. On "Add Updates to Baseline" window, enter "Critical Updates".
The window displayed all updates with "Critical Updates" key word. However, the result also included all critical updates for Windows Server 2012 and Windows Server 2012 R2. Luckily, the result of Windows Updates is automatically sorted according to Windows Version.
11. Select all Windows Server 2012 R2 "Critical Updates", click "Add".
12. On "Updates" window, click "Next".
13. On "Assignment Scope", we can select host groups to assign updates. In my lab, I check "hv02".
14. Click "Next".
15. On "Summary" window, click "View Script".
Administrators can save and modify this script to create another baseline.
16. Copy and save the script to C:\CUpdate06.ps1
17. Click "Finish".
A new baseline, Critical Updates for Hyper-V hosts 2012 R2, was created.
Based on the filter of "Update Baseline Wizard", it's easy for us to filter the date, version and etc of Windows Updates so we need to use PowerShell to create a new baseline.
17. Launch "Windows PowerShell ISE" as administrator.
18. The script is based on the following requirements to modify it.
~ The Windows Updates are released in June of 2014
~ The Windows Updates are for Windows Server 2012 R2
~ The classification of Windows Updates is Critical
~ The baseline name is "Critical Updates 06-2014 for Hyper-V hosts 2012 R2"
~ Applied to HV02
$baseline = New-SCBaseline -Name "Critical Updates 06-2014 for Hyper-V hosts 2012 R2" -Description ""
$CUUpdate06 = Get-SCUpdate | Where Creationdate -gt 6/1/2014 | Where UpdateClassification -eq 'Critical Updates' | Where Products -eq 'Windows Server 2012 R2'
$scope = Get-SCVMMManagedComputer -ComputerName "hv02.test.tls1.lab"
Set-SCBaseline -Baseline $baseline -AddAssignmentScope $scope -RunAsynchronously -AddUpdates $CUUpdate06 -StartNow
18. Press "F5" to perform this script.
19. On "Windows PowerShell ISE", press "OK" to save and run it.
As a result, the new baseline, Critical Updates 06-2014 for Hyper-V hosts 2012 R2, was created.
This posting is provided “AS IS” with no warranties, and confers no rights!
No comments:
Post a Comment