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

Configuration Manager 2012 R2 – How to: Move a Distribution Point Content Library to another drive

Today I had to move the library of the Distribution Point to another partition, because it was placed on the wrong partition during the install.

During the installation of ConfigMgr 2012 R2 (or ealier), you can place a file “no_sms_on_drive.sms” on the partitions that should be ignored for placing the library on.
In this environment there’s a C:, D: and E: drive. The C: partition is only used for the operating system. The D: drive is used for the installation of
ConfigMgr 2012 R2, SQL 2012 and the remote installation folder of WDS. The E: drive is used for the sources, images, ISO’s and the library of the Distribution Point.

So I want to move the library from the D: to the E: partition. First you’ve to download the “System Center 2012 R2 Configuration Manager Toolkit”. http://www.microsoft.com/en-us/download/details.aspx?id=36213

1.) Open REGEDIT and navigate to HKLM\SOFTWARE\Microsoft\SMS\DP and look for the registry key
ContentLibraryPath” and “ContentLibUsableDrives
2.) When you open Windows Explorer and browse to the D: drive, you’ll see the library folders
SCCMContentLib
SMSPKG
SMSPKGD$
SMSPKGSIG
SMSSIG$
These folders we want to move to the E: drive
3.) Open the command prompt and navigate to C:\Program Files (x86)\ConfigMgr 2012 Toolkit R2\ServerTools\”
4.) Use the following command to move the Library content from D: to E:
ContentLibraryTransfer.exe -SourceDrive D -TargetDrive E > C:\TransferContentLibrary_log.txt
5.) Start CMTrace.exe and open the logfile “C:\TransferContentLibrary_log.txt” to watch the progress of the library move
6.) After a few hours, depending on the size of your library content, the move action is done
7.) pen REGEDIT and navigate to HKLM\SOFTWARE\Microsoft\SMS\DP and look for the registry key
ContentLibraryPath” and “ContentLibUsableDrives
Now you’ll see only the E: drive for the Library placement
8.) I’ve have created the file “no_sms_on_drive.sms” on the C: and D: drive

2015-03-12_10h18_06    2015-03-12_10h18_58    2015-03-12_10h19_13

2015-03-12_10h19_32    2015-03-12_10h21_23    2015-03-12_10h45_29

2015-03-12_10h45_51    2015-03-12_10h46_26    2015-03-12_10h46_59

2015-03-12_11h54_26    2015-03-12_11h55_02    2015-03-12_11h57_32

How to: View all packages within your ConfigMgr 2012 R2 environment

When you have a Microsoft ConfigMgr 2012 or 2012 R2 environment, you definitely have a lot of packages and applications. This could be: tools, scripts, client packages, boot images, ISO’s, WIM files, different software applications, etc. When you have no idea where all these source files are located, you can execute a query within your SQL environment.

You can generate an overview of all your packages, with the package ID, description, name, source location, version, etc. Very helpfull and it saves you alot of time!!

1.) Open the Microsoft SQL Server Managent Studio
2.) Login with a user that has enough rights to execute queries
3.) Select the ConfigMgr database (in my example CM_PS1)
4.) Select “New Query”
5.) Type “SELECT * from v_Package”
6.) Select “Execute” or press F5 on your keyboard
7.) Now you’ll see a list off all the packages within your ConfigMgr 2012 environment
8.) Navigate to the table “PkgSourcePath”
9.) Here are your source files locates of all the different packages

2015-02-19_11h03_04    2015-02-19_11h03_54    2015-02-19_11h04_36

2015-02-19_11h05_03    2015-02-19_11h16_42

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