When setting up ConfigMgr 2012 R2 in a lab and test, or any type of Proof-Of-Concept you want to automate everything. Luckily the Cumulative Update (CU) 4 download has support for unattended setup: Just add the /Unattended switch to the extracted download and you’re good.
Note: Don’t use the /unattended switch in a production environment without having a SQL Backup of the Site Server. The unattended setup will update the site server database by default.
The command
Installing CU4 unattended is a simple as this:
CM12-R2CU4-KB3026739-X64-ENU.exe /Unattended
Note: The /Unattended switch cause the CU4 setup to do almost everything the manual setup does, keep on reading for more info…
Verifying the setup
After setup you can review the log files in C:\Windows\Temp, but you can also check the CU Level installed by running this command:
Get-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\SMS\Setup -Name "CULevel"
Displaying the CU level installed.
You can also verify that the ConfigMgr console was updated by running this command (should return 5.0.7958.1501 which is the CU4 version):
(Get-Item ($env:SMS_ADMIN_UI_PATH.Substring(0,$env:SMS_ADMIN_UI_PATH.Length – 5) + '\Microsoft.ConfigurationManagement.exe')).VersionInfo.FileVersion
Checking the ConfigMgr console version.
The difference from manual setup
As mentioned, the /Unattended switch cause the CU4 setup to do almost everything the manual setup does. Well, except from creating the four update packages for secondary site servers, consoles and x86/x64 clients.
Luckily, creating four packages and four programs in PowerShell is not that hard :)
$SiteServer = $Env:COMPUTERNAME # Import the ConfigMgr PowerShell module Import-Module $env:SMS_ADMIN_UI_PATH.Replace("\bin\i386","\bin\configurationmanager.psd1") $SiteCode = Get-PSDrive -PSProvider CMSITE Set-Location "$($SiteCode.Name):\" # Create the Configuration Manager Updates folder New-Item "$($SiteCode):\Package\Configuration Manager Updates" # Create the console update package $ConsolePackage = New-CMPackage -Name "R2 CU4 - console update - $SiteCode" -Description "R2 CU4 - console update - $SiteCode" -Path "\\$SiteServer\SMS_$SiteCode\hotfix\KB3026739\AdminConsole\i386" Move-CMObject -FolderPath "$($SiteCode):\Package\Configuration Manager Updates" -InputObject $ConsolePackage New-CMProgram -PackageName $ConsolePackage.Name -StandardProgramName "Cumulative update 4 - console update install" -CommandLine "msiexec.exe /p configmgr2012adminui-r2-kb3026739-i386.msp /L*v %TEMP%\configmgr2012adminui-r2-kb3026739-i386.msp.LOG /q REBOOT=ReallySuppress REINSTALL=ALL REINSTALLMODE=mous" -ProgramRunType WhetherOrNotUserIsLoggedOn -RunMode RunWithAdministrativeRights -UserInteraction $false # Create the server update package $ServerPackage = New-CMPackage -Name "R2 CU4 - server update - $SiteCode" -Description "R2 CU4 - server update - $SiteCode" -Path "\\$SiteServer\SMS_$SiteCode\hotfix\KB3026739\Server\x64" Move-CMObject -FolderPath "$($SiteCode):\Package\Configuration Manager Updates" -InputObject $ServerPackage New-CMProgram -PackageName $ServerPackage.Name -StandardProgramName "Cumulative update 4 - server update install" -CommandLine "CM12-R2CU4-KB3026739-X64-ENU.exe /Unattended" -ProgramRunType WhetherOrNotUserIsLoggedOn -RunMode RunWithAdministrativeRights -UserInteraction $false # Create the x64 client package $x64ClientPackage = New-CMPackage -Name "R2 CU4 - x64 client update - $SiteCode" -Description "R2 CU4 - x64 client update - $SiteCode" -Path "\\$SiteServer\SMS_$SiteCode\hotfix\KB3026739\Client\x64" Move-CMObject -FolderPath "$($SiteCode):\Package\Configuration Manager Updates" -InputObject $x64ClientPackage New-CMProgram -PackageName $x64ClientPackage.Name -StandardProgramName "Cumulative update 4 - x64 client update install" -CommandLine "msiexec.exe /p configmgr2012ac-r2-kb3026739-x64.msp /L*v %TEMP%\configmgr2012ac-r2-kb3026739-x64.msp.LOG /q REINSTALL=ALL REINSTALLMODE=mous" -ProgramRunType WhetherOrNotUserIsLoggedOn -RunMode RunWithAdministrativeRights -UserInteraction $false # Create the x86 client package $x86ClientPackage = New-CMPackage -Name "R2 CU4 - x86 client update - $SiteCode" -Description "R2 CU4 - x86 client update - $SiteCode" -Path "\\$SiteServer\SMS_$SiteCode\hotfix\KB3026739\Client\x86" Move-CMObject -FolderPath "$($SiteCode):\Package\Configuration Manager Updates" -InputObject $x86ClientPackage New-CMProgram -PackageName $x86ClientPackage.Name -StandardProgramName "Cumulative update 4 - x86 client update install" -CommandLine "msiexec.exe /p configmgr2012ac-r2-kb3026739-i386.msp /L*v %TEMP%\configmgr2012ac-r2-kb3026739-i386.msp.LOG /q REINSTALL=ALL REINSTALLMODE=mous" -ProgramRunType WhetherOrNotUserIsLoggedOn -RunMode RunWithAdministrativeRights -UserInteraction $false
The four packages created using PowerShell.
More ...