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

How to: Enable RDP during Task Sequence with SCCM 2012 R2

I quiet often receive the question how to enable Remote Desktop (RDP) access on a server during a task sequence in SCCM 2012 or 2012 R2. Because by default RDP is not enabled, it could be realy handy to enable RDP access to control your server remotely. There’re a whole bunch of tools to manage your server(s) remotely, but still RDP could be ncessary.

1.) Create a new package with the source location to your script directory.
2.) Create a new package with a program and use the following command:
Powershell.exe -ExecutionPolicy Unrestricted -NoProfile -File Enable-RDP.ps1
3.) The PowerShell script ‘Enable-RDP.ps1’ contains the following code. See in this post below.
4.) Insert the script in your task sequence

##
## Enable RDP
Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server' -name "fDenyTSConnections" -Value 0
##
## Enable Firewall Rule
Enable-NetFirewallRule -DisplayGroup "Remote Desktop"
##
## Enable RDP Authentication
Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -name "UserAuthentication" -Value 0

2015-11-27_09h03_02    2015-11-27_09h03_21    2015-11-27_09h34_03

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!! 🙂

SCCM 2012 R2 SP1 CU1….Why are my task sequences not visible?

This week I’ve upgraded a SCCM 2012 R2 environment to Service Pack 1 with update CU1. After the upgrade, I noticed that not all my task sequences (deployment) where available after PXE boot. Why is that? Is this a ‘new feature’ or just a ‘bug’? After some Troubleshooting I’ve figured out that there’s a strange thing in my deployments!

As you can see in my example I’ve created a collection with 3 deployments active. After PXE boot a virtual machine, only the first deployment is available?!?! :S The other two deployments are also active, but not available…

When we go to the properties of the other two deployments, and change the schedule 1 day back in the time, the deployment became available!! Very strange behavior, but this is the only ‘solution’ I’ve figured out!

2015-10-05_21h47_55    2015-10-05_21h48_48    2015-10-05_21h50_01

2015-10-05_21h50_49    2015-10-05_21h52_01    2015-10-05_21h52_07

2015-10-05_21h52_33    2015-10-05_21h52_50    2015-10-05_21h53_00

2015-10-05_21h54_37    2015-10-05_21h54_43    2015-10-05_21h55_05

How to: Disable network selection OOBE during a task sequence in ConfigMgr 2012 R2

During a deployment of Microsoft Windows 8/8.1, you’ll receive a question to select a prefered network connection. This is also happening during a task sequence within Microsoft SCCM 2012 R2. It’s easy to disable this
question during the task sequence, using an unattend XML file.

1.) First open the “Windows System Image Manager”, also known as WSIM
2.) Select the image you want to deploy. In my example “Install.WIM” from the Windows 8.1 source files
3.) Create a new catalog for this image
4.) After the catalog has succesfully created, create a “New Answer File”
5.) Navigate to the following selection
amd64_Microsoft-Windows-Shell-Setup_6.3.9600.17031_neutral
6.) Select the “+” on the left side and naviagte to “OOBE”
7.) Right-click on “OOBE” and select “Add Settings to Pass7oobeSystem
8.) Select in the right pane OOBE
9.) Select in the properties pane “HideWirelessSetupInOOBE” and set the value to “True”
10.) Save the XML file on your “source” directory on your primary site server
11.) Create a new package with the source directory to the directory you’ve created in the stap before
12.) Do NOT create any program in the package, so select “Do not create a program”
13.) Distribute the new package to your distribution point(s)
14.) Open your task sequence and navigate to stap “Apply Operating System”
15.) Select the option “Use an unattended or Sysprep answer file for a custom installation
16.) Select the package you’ve created before and type the name of your XML file within that package source location
17.) Boot a client from the network (PXE) and select the task sequence.

If you follow the steps within the task sequence, you’ll see that you didn’t receive a network connection screen anymore.

2015-03-16_10h34_12    2015-03-16_10h35_34    2015-03-16_10h49_24

2015-03-16_10h56_31    2015-03-16_10h57_29    2015-03-16_10h57_36

2015-03-16_10h57_54    2015-03-16_10h58_08    2015-03-16_10h58_22

2015-03-16_10h58_34    2015-03-16_10h59_21    2015-03-16_11h01_38

2015-03-16_11h02_14    2015-03-16_11h03_12    2015-03-16_11h03_45

How to: Deploy packages using collection variable with ConfigMgr 2012 R2

During a OS deployment you don’t want to deploy all your packages and software to every workstation. You can deploy the software after a full OS deployment, but you can also deploy packages during the OSD using collection variables. Now it is possible to deploy packages only if a specific machine is a member of a collection. This collection can be query based, for example OU membership or Active Directory security group, or it can be static (direct membership).

In this example I’ve created a realy simple deployment, Adobe Reader 11.0. I’ve two virtual machines, SCWIN81-01 and SCWIN81-02. Both machines are members of the collection “Deploy – Windows 8.1 Enterprise x64”, where the task sequence is deployed on. Machine SCWIN81-01 is also member of the collection “Install – Adobe Reader 11.0”. This collection has a limited collection of “Deploy – Windows 8.1 Enterprise x64”. Both machines are deployed on the same time, the only difference is that machine SCWIN81-01 has Adobe Reader 11.0 installed and machine SCWIN81-02 not. Why……based on the collection variable during the OSD 🙂

1.) First create the collections
2.) Make the specific machines members of the right collections (query based or direct membership)
3.) Open the properties of the collection “Install – Adobe Reader 11.0” and navigate to the “Collection Variables” tab
4.) Add one or more variables with some values. In this example the variable is “APP-AdobeReader” with the value “Yes”
5.) Open the task sequence and add a package installation step
6.) Add the package with the program and navigate to the “Options” tab
7.) Select “Add Condition” and select “Task Sequence Variable”
8.) Enter the collection variable you’ve created earlier with the same value. In my example:
Task Sequences Variable APP-AdobeReader equals “Yes”
9.) Select “Apply” and close the task sequence.
10.) Start the OSD on both machines and wait until the installation is done!
11.) Watch the differences between both machines, if everything is okay, one machine has Adobe Reader installed and the other not.

This is an extremely powerfull thing within ConfigMgr, and really helpfull is some scenario’s. For example VDI golden image deployments or hybrid environments with laptops/desktops or multiple organizations using one ConfigMgr environment. One main reason could be consolidation in task sequences. If you want, there should be only one task sequence for all you different deployments. This is why I’m loving collection varaibles! 🙂

2014-12-22_15h45_33    2014-12-22_15h46_26    2014-12-22_15h46_48

2014-12-22_15h47_23    2014-12-22_15h49_46    2014-12-22_15h50_15

2014-12-22_15h50_37    2014-12-22_15h51_16    2014-12-22_15h51_58

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