How to: Initialize, format and label disks during OSD Task Sequence in SCCM 2012 R2

During a task seuence in Microsoft SCCM 2012 R2, the operating system and applications are installed on the C: drive in most situations. But in some deployments, you definitely want to create more disks. For example, you want to create a D: and E: partition for storing some other data. Maybe for Microsoft SQL or Exchange installation, databases, logfiles or just some other data.

The following script will do all these steps for you during the task sequence. The script initialize, format, partition and label the disks for you….fully automated! 🙂

## Set CD-ROM from E: to X:
Set-WmiInstance -InputObject ( Get-WmiObject -Class Win32_volume -Filter "DriveLetter = 'E:'" ) -Arguments @{DriveLetter='X:'}

$disks = Get-Disk | measure
If($disks.Count -eq 2)
{
## Initialize all new disks
Initialize-Disk 1
## Format and rename disks
Get-Disk | where {$_.Number -eq "1"} | New-Partition -UseMaximumSize | Format-Volume -FileSystem NTFS -NewFileSystemLabel Data -Confirm:$false
## Set drive letters (D: - Data, E: - Backup)
Get-Disk | where {$_.Number -eq "1"} | Get-Partition | where {$_.PartitionNumber -eq 2} | Set-Partition -NewDriveLetter D
}
elseif($disks.Count -eq 3)
{
## Initialize all new disks
Initialize-Disk 1
Initialize-Disk 2
## Format and rename disks
Get-Disk | where {$_.Number -eq "1"} | New-Partition -UseMaximumSize | Format-Volume -FileSystem NTFS -NewFileSystemLabel Data -Confirm:$false
Get-Disk | where {$_.Number -eq "2"} | New-Partition -UseMaximumSize | Format-Volume -FileSystem NTFS -NewFileSystemLabel Backup -Confirm:$false
## Set drive letters (D: - Data, E: - Backup)
Get-Disk | where {$_.Number -eq "1"} | Get-Partition | where {$_.PartitionNumber -eq 2} | Set-Partition -NewDriveLetter D
Get-Disk | where {$_.Number -eq "2"} | Get-Partition | where {$_.PartitionNumber -eq 2} | Set-Partition -NewDriveLetter E
}
else
{
exit
}
exit

The script first checks how many disks are attached to the server.
If there is only one disk attached, you’ll have only a C: drive available after the deployment.
If there are 2 disks attached, you’ll have a C: and D: drive avalailable after the deployment.
If there are 3 disks attached, you’ll have a C:, D: and E: drive available after the deployment.

The CD-ROM drive will alse changed from E: to X:.

2015-12-18_12h30_44    2015-12-18_12h32_27    2015-12-18_12h32_52

2015-12-18_12h34_31    2015-12-18_12h37_51    2015-12-18_12h41_05

2015-12-18_12h41_43

SCCM 2012 R2 Build and Capture…installing updates takes a long time!

This month I’ve to install and configure a Microsoft SCCM 2012 R2 environment. This customer is going to use SCCM basically deploying Windows Server 2012 R2 virtual machines. For the task sequences I’ve used the Windows Server 2012 Update 1 ISO, but there’re a few updates available in the past (around the 122 updates!!)

So I’ve configured a new Build and Capture task sequence to deploy a “Golden Image”. I’ve also integrated Windows Server Updates Services (WSUS) within SCCM, so during the Build and Capture task sequence the updates will also be installed. The task sequence takes a long time. After some troubleshooting, I’ve found some of the main reasons….Update KB3000850. This update is around the 700 MB and takes a long time to install!

Solution:
First of all, I’ve updated the Windows Server 2012 R2 WIM from the ISO with the latest Windows updates using Offline Servicing. This great feture is available within SCCM 2012 R2. With Offline Servicing it is possible to apply Windows Updates in a WIM file offline. After applying update KB3000850 in the WIM image, the Build and Capture task sequences is going realy faster!! 🙂

How to: Add computer to security group with ConfigMgr 2012 during OSD

In some cases you’ve to add computer to a Active Directory security group. For example Direct Access laptops. In this example I’ve created a VBS script for adding a computer to an Active Directory security group during OSD in ConfigMgr 2012 R2.

1.)  Create a new package within ConfigMgr 2012 R2 without a program
2.) Distribute the new package to you distribution point(s)
3.) Copy the script “ADgroup.vbs” to the source location of your new package
4.) Add a step “Run Command Line” to your task sequence
5.) Add the command line: cscript.exe adgroup.vbs [name of your AD group]
6.) Select the package “Scripts”
7.) Select a account with enough privileges to add (new) computer object to the Active Directory
8.) Deploy your task sequence to a collection

You can download the script here. (Right-click and save…)

2014-12-12_15h53_47    2014-12-12_15h58_35    2014-12-12_15h59_14

2014-12-12_15h59_50    2014-12-12_16h42_54    2014-12-12_16h43_11

2014-12-12_16h43_34    2014-12-12_16h43_48

How to: Directly install from a distribution point during OSD in ConfigMgr 2012 R2

During a OS deployment with ConfigMgr 2012 R2, the WIM file is downloaded locally and than installed on the C: drive of your system. The download proces for the install.wim file takes a while! This post will discribe how to configure the task sequence to directly apply the install.wim from the distribution point.

1.) Open the task sequence and select the step “Apply Operating System”. Navigate to the “Options” tab.
2.) Select “Access content directly from the distribution point” and select “Apply”
3.) Navigate to your Operating System Images and select the properties of the image
4.) Navigate to the “Data Access” tab
5.) Select “Copy the content in this package to a package share on distribution points”
6.) Select “Apply”
7.) The install.wim file will be copied to the SMSPKGE$ folder on your distribution point
8.) Right click on the image and select “Update Distribution Points”
9.) Wait until the content status is “Success”
10.) Start a deployment of a system
11.) The download step is gone now and the image will be installed directly from the distribution point

OSDC_01    OSDC_02    OSDC_03

OSDC_04    OSDC_05    OSDC_06

OSDC_07    OSDC_08    OSDC_09

OSDC_10    OSDC_11    OSDC_12

OSDC_13    OSDC_14    OSDC_15

OSDC_16    OSDC_17    OSDC_18

How to: Install ConfigMgr 2012 R2 hotfix KB2910552 during OSD

A few weeks ago Microsoft has released a update KB2910552 for ConfigMgr 2012 R2. This update fixes a lot of issues, but also speed up the OSD within ConfigMgr 2012 R2. I should highly recommend to install this hotfix in your environment. The hotfix is updating the site system automatically, but the client not. This blogpost will discribe how to install this hotfix during a OS deployment (OSD).

1.) First install the hotfix KKB2910552. The hotfix is vissible in the installation folder of ConfigMgr. In my example E:\Program Files\Microsoft Configuration Manager\hotfix\KB2910552\Client
2.) Copy the content in this folder to your source directory.
In my example \\CM01\Sources\OSD\Hotfix\KB2910552\Client
3.) Add a new package and configure the source location to the right directory.
In my example \\CM01\Sources\OSD\Hotfix\KB2910552\Client
4.) Select “Do not create a program
5.) Distribute the package to your distribution point(s)
6.) Open the task sequence and add a new step “Run Command Line
7.) Select the right package and configure the command line
cmd.exe /c xcopy x64\*.* “C:\Hotfix” /E /H /C /I /Q /Y
This is for x64 systems only! Change x64 to x86 for deployment to x86 systems
8.) In the “Setup Windows and Configuration Manager” step, add the following installation properties
PATCH=”C:\Hotfix\configmgr2012ac-r2-kb2910552-x64.msp”
This is for x64 systems only! Change x64 to x86 for deployment to x86 systems
9.) Start the deployment of a x64 system
10.) After the deployment has finished, navigat to the control panel and Configuration Manager
11.) On the general tab you’ll see the new version number 5.00.7958.1104

HF_01    HF_02    HF_03

HF_04    HF_05    HF_06

HF_07    HF_08    HF_09

HF_10    HF_11    HF_12

HF_13    HF_14    HF_15

HF_16

How to: change database collation in SQL 2012 R2

When you default install an SQL 2012 R2 server, the database collation is “Latin1_General_CI_AS“. But if you want to install System Center Configuration Manager, one of the prerequisites is that the database collation is “SQL_Latin1_General_CP1_CI_AS“. My SQL server has only one instance, so I had to change the database collation. There are no databases configured yet, so no problem for me at all.

See also the following URL:
http://technet.microsoft.com/en-US/library/ms179254(v=sql.105).aspx

1.) Make sure you backup all your data!
2.) Attach the SQL 2012 R2 ISO
3.) Run the command prompt as administrator
4.) Type the following command
Setup /QUIET /ACTION=REBUILDDATABASE /INSTANCENAME=InstanceName
/SQLSYSADMINACCOUNTS=accounts /SAPWD= StrongPassword
/SQLCOLLATION=CollationName
4.) After the setup has finished, the database collation has changed. You’re now ready to rock!

2014-01-17_09h28_36    2014-01-17_09h29_07    2014-01-17_09h32_09