Recently I ran into a situation where I needed to customize the OS capture media in System Center Configuration Manager 2007 as the standard capture media created by ConfigMgr does not have any way to be modified or customized. 

The reason for customizing the capture media was to create an image with the SCCM client in it as we wanted to deploy this image to the Internet based client machines.

So we started by creating a reference machine which was a Vista machine. We installed the SCCM client on it using the following command line.

ccmsetup.exe /source: C:\ccmclient /native: CCMALWAYSINF=1 SMSMP=sccm2007.contoso.com SMSSITECODE=CEN DNSSUFFIX= contoso.com CCMHOSTNAME= sccm2007.contoso.com ccmhttpsstate=1

After the Advanced Client is installed, we stopped the “SMS agent host” service and then ran the CCMDelCert.exe utility to delete any certificates from the Advanced Client and also deleted the %SystemRoot%\Smscfg.ini file.

We had to start the “SMS agent Host” because the Config Mgr capture media would fail if it doesn’t find this service.

So far so good. We were able to capture the image fine and we were able to deploy this image as well.

Everything seemed fine but guess what?  After the OS deployment the SCCM clients on these machines were not able to communicate with the SCCM server.

We found out that these machines are Internet based so they don’t have a way to find out the site code and other information from AD or WINS.

Now you’ll think, didn’t we give SMSSITECODE, SMSMP and other information while installing the SCCM client on the reference machine?  Yes, we did give this information however after the image deployment these parameters were missing causing the Internet based SCCM client to fail.

So how did this happen?

We used the standard capture media created by ConfigMgr to capture the OS image, which removed all the SCCM client configuration including the SiteCode information. This is the default behavior of this media.

Here are snippets from the SMSTS.log where the ConfigMgr capture media is unassigning the SCCM client and deleting the certificate during the Image capture:

Expand a string: FullOS    TSManager       
Executing command line: osdpreparesmsclient.exe    TSManager       
rKey.Open( (( HKEY ) (ULONG_PTR)((LONG)0x80000002) ), c_szSmsIdentificationKey, ((((0x00020000L)) | (0x0001) | (0x0008) | (0x0010)) & (~(0x00100000L))) ), HRESULT=80070002 (e:\nts_sms_fre\sms\client\osdeployment\preparesmsclient\preparesmsclient.cpp,665)    PrepareSMSClient       
This computer does not have SMS site server installed    PrepareSMSClient       
MsiEnumRelatedProducts OK. Product code = {CE6A85D8-D6B9-479A-9FE9-A06E56881E61}    PrepareSMSClient       
MsiGetProductInfo ok. Product Major version number = 4    PrepareSMSClient       
The version of SMS Client installed is supported for capture    PrepareSMSClient       
Check ok. SMS Client is not operating as a BranchDP Agent    PrepareSMSClient       
Checks succeeded. Client meets capture requirements    PrepareSMSClient       
Set TSEnv:SMSClientVersion=4.00.6221.1000 ok    PrepareSMSClient       
:
:
:
Stopped the service 'ccmexec' successfully    PrepareSMSClient       
Successfully stopped the client agent service.    PrepareSMSClient       
UnAssigning the SMSClient succeeded    PrepareSMSClient       
Removing SitePolicy succeeded.    PrepareSMSClient       
Successfully opened client certificate store.    PrepareSMSClient       
No certificates to delete    PrepareSMSClient       
Deleting Client properties from file C:\WINDOWS\SMSCFG.INI succeeded.    PrepareSMSClient       
Reseting the Trusted Root Key successful    PrepareSMSClient       
Deleting instance of 'CCM_Client' successful    PrepareSMSClient       
Successfully reset Registration status flag to "not registered"    PrepareSMSClient       
Successfully disabled provisioning mode.    PrepareSMSClient       
Deleted 0 instances    PrepareSMSClient       
Policy cleanup done    PrepareSMSClient       
Setting startup type for 'smstsmgr' service to manual..    PrepareSMSClient       
'smstsmgr' service is configured to be manual    PrepareSMSClient       
Execute method succeeded    PrepareSMSClient       
SMS Client has been successfully prepared for OS capture    PrepareSMSClient       
Process completed with exit code 0    TSManager       
Successfully complete the action (Prepare Configuration Manager Client) with the exit win32 code 0    TSManager

Now there are two ways to fix this issue to make sure that SCCM client on a Internet based machine does have the SiteCode and MP information with it.

1) Re-run the the CCMSetup (with all the parameters) on these machines by modifying the task sequence steps during the post OS Deployment phase.

2) If we could somehow create a custom capture media which will not remove the SiteCode and SMSMP information from the SCCM client.

So this is when we decided to create custom capture media. I thought it might be complicated but it wasn’t.

We just had to make sure that we pass all the paremeters require by the Capture media in the task sequence.  So finally here are the steps to create the custom Capture media.

1) Go to Operating System Deployment in the SCCM console and Right Click on Task Sequence -> New -> Task Sequence

2) Select “Create a new custom task sequence” and click next.

3) Give a Task Sequence Name. I gave it “MS TEST” and selected the appropriate Boot Image. Click next and then Close.

4) Now right click on “MS TEST” task sequence and select edit.

5) Click on Add and select New Group. You can change the Name of the Group. I called it “Capture the Reference Machine”.

clip_image001

6) If you want to capture image from a Windows XP image then you need to make sure that SYSprep file is copied on to the reference machine. To do this you can follow the steps 7 and 8, otherwise for a Windows Vista machine you can ignore it.

7) Create a package for the Sysprep file and make sure the distribution point has been added for it. You don’t need to create any programs for it.

8) In the task sequence editor click on Add -> Images -> Install Deployment Tools. Browse for the Sysprep package.

clip_image002

9) Click on Add -> General -> Set Task Sequence Variable.

10) Repeat step 9 and add another Set Task Sequence Variable. Refer to the next two pics below.

11) In the First “Set Task Sequence Variable”. The variable name would be OSDTargetSystemRoot and its value should be the location of the Windows directory of the reference machine (C:\Windows). You can change the Name of this variable if you wish to.

clip_image003

12) In the Second “Set Task Sequence Variable”. The variable name would be OSDTargetSystemDrive and its value should be the System Drive of the reference machine. In my lab it was C:

clip_image004

13) In the task sequence editor Click on Add -> Images -> Prepare Windows for Capture. I left this step with the default option. You can chose to automatically build mass storage drive and Do not reset activation flag options here.

clip_image005

14) Now we need to add the last step in the task sequence. Add -> Images -> Capture Operating System Image. In this step, we must provide the value for the Destination, which is the share path and file name of of the .wim file i.e. captured image.

15) We also need to provide the credentials to connect to the Destination defined above. Other parameters are optional.

clip_image006

16) After creating the above step click Ok and then again right click on your custom task sequence and select Create Task Sequence Media.

17) Choose Stand-Alone media and hit Next. You can chose either CD/DVD set or USB Flash drive. Give the Media File Name and click Next.

18) If you want you can Protect your capture media with password or else uncheck this option and hit Next.

19) Select the Boot Image accordingly and then select the Distribution point and then finish the wizard to get the Media file created.

On the reference machine, make sure to run the CCMDelCert.exe utility to delete any certificates from the Advanced Client and also delete the %SystemRoot%\Smscfg.ini file before running this Custom Capture Media on it.

Note: This information was originally contributed by Rahul Prasad, Configuration Manager Support Engineer, on the Configuration Manager Support Team blog:

http://blogs.technet.com/configurationmgr/archive/2009/10/13/how-to-create-custom-operating-system-capture-media-using-configmgr-2007.aspx