In Microsoft System Center Configuration Manager 2007 you capture operating system media for use with operating system deployment by using the TsMediaClass Client COM Automation Class ITsMediaClass::CreateCaptureMedia Method method.

There are a number of TsMediaClass Client COM Automation Class properties that you have to populate before calling CreateCaptureMedia:

Property Description

ProviderName

The provider name. Use localhost for the local computer.

SiteCode

The Configuration Manager 2007 site code.

DistributionPoints

A comma-delimited list of distribution points. Use localhost for the local computer.

ConnectionOptions

A comma-delimited list of name value pairs that are used when establishing the Windows Management Instrumentation (WMI) connection to the provider. The possible values are documented in ITsMediaClass::ConnectionOptions Property.

MediaLabel

The label for the media.

CreateCaptureMedia has the following parameters that you supply.

Parameter Description

MediaType

Specifies the type of media that is created. This can be ISO, WIM, UFD and UFD + Format. For more information, see CreateCaptureMedia.

DestinationPath

The path and file name for the created image.

BootImageID

Identifies the boot image that the image is created for. You can obtain this value from the boot image's SMS_BootImagePackage Server WMI Class object PackageID property.

Async

Specifies whether the call to CreateCaptureMedia is performed synchronously (false) or asynchronously (true). This parameter is optional, and if it is omitted, the call is synchronous.

To create capture media

  1. Create an instance of the TsMediaClass Client COM Automation Class object

  2. Populate the ProviderName, SiteCode, DistributionPoints, ConnectionOptions and MediaLabel properties

  3. Call the CreateCaptureMedia method to create the ISO file.

Example

The following example asynchronously creates a CD ISO file.

For information about calling the sample code, see How to Call Configuration Manager COM Automation Objects.

Visual Basic Script  Copy Code
Sub CaptureMedia(providerName,_
		siteCode, 	 _
		distributionPoints, _
		connectionOptions,  _
		mediaLabel, 	 _
		mediaType, 	_
		destinationPath, _
		bootImageId)

	Dim tsmedia
	Set tsmedia = CreateObject("Microsoft.ConfigMgr.TsMedia")

	' Change these properties according to your configuration.
	tsmedia.ProviderName = providerName
	tsmedia.SiteCode = siteCode
	tsmedia.DistributionPoints = distributionPoints
	tsmedia.ConnectionOptions = connectionOptions
	tsmedia.MediaLabel = mediaLabel

	' Asynchronously create the ISO, and display progress until completion.
	Dim hr
	hr = tsmedia.CreateCaptureMedia( mediaType, destinationPath, bootImageId, true)
	While tsmedia.Status = 0
		WScript.echo tsmedia.CurrentStep & "/" & tsmedia.NumSteps & _
		"  (" & tsmedia.StepProgress & ")  " & tsmedia.StepInfo
		WScript.sleep 1000
	Wend

	WScript.echo "Capture media creation finished with result = " & tsmedia.ExitCode
End Sub
Important
No C# example was included due to a known issue with TsMediaClass Client COM Automation Class.

The example method has the following parameters:

Parameter Type Description

providerName

VBScript: string

The SMS Provider computer name.

siteCode

VBScript: string

The Configuration Manager 2007 site code.

distributionPoints

VBScript: string

A comma-delimited list of distribution point computers.

connectionOptions

VBScript: string

A comma-delimited list of name value pairs that is used when establishing the WMI connection to the provider.

mediaLabel

VBScript: string

The label for the media.

mediaType

VBScript: string

Specifies the type of media that is created. This can be ISO, WIM, UFD and UFD + Format.

destinationPath

VBScript: string

The path and file name for the created image.

bootImageID

VBScript: string

The boot image identifier. You can obtain this value from the boot image's SMS_BootImagePackage Server WMI Class PackageID property.

Robust Programming

For more information about error handling, see About Configuration Manager Errors.

Security

For more information about securing Configuration Manager applications, see About Securing Configuration Manager Applications.

See Also


Send comments about this topic to Microsoft.