New-CMPrestageMedia

Create an OS deployment prestaged media file.

Syntax

New-CMPrestageMedia
   [-Application <IResultObject[]>]
   [-Comment <String>]
   [-CreatedBy <String>]
   [-DriverPackage <IResultObject[]>]
   [-IncludeApplicationDependency]
   -OperatingSystemImage <IResultObject>
   [-OperatingSystemImageIndex <Int32>]
   [-Package <IResultObject[]>]
   -TaskSequence <IResultObject>
   [-Version <String>]
   [-AllowUacPrompt]
   [-AllowUnattended]
   [-AllowUnknownMachine]
   -BootImage <IResultObject>
   [-CertificateExpireTime <DateTime>]
   [-CertificatePassword <SecureString>]
   [-CertificatePath <String>]
   [-CertificateStartTime <DateTime>]
   -DistributionPoint <IResultObject[]>
   [-Force]
   -ManagementPoint <IResultObject[]>
   [-SiteCode <String>]
   -MediaMode <MediaMode>
   [-MediaPassword <SecureString>]
   [-NoAutoRun]
   -Path <String>
   [-PrestartCommand <String>]
   [-PrestartPackage <IResultObject>]
   [-TemporaryFolder <String>]
   [-UserDeviceAffinity <UserDeviceAffinityType>]
   [-Variable <Hashtable>]
   [-DisableWildcardHandling]
   [-ForceWildcardHandling]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

The New-CMPrestageMedia cmdlet creates a file to prestage an OS image on a new hard drive. For more information, see Plan prestaged media.

Note

Run Configuration Manager cmdlets from the Configuration Manager site drive, for example PS XYZ:\>. For more information, see getting started.

Examples

Example 1: Create prestaged media

The first command gets the management point object for the site system server named mp01.contoso.com in the site code CM1 and stores the object in the $ManagementPoint variable.

The second command gets the boot image object named BootImage01 and stores the object in the $BootImage variable.

The third command gets the distribution point object for the site system server named dist01.contoso.com in the site code CM1 and stores the object in the $DistributionPoint variable.

The fourth command gets the OS image object named OSImagePkg01 and stores the object in the $OSImage variable.

The last command creates a dynamic prestaged media file named PrestagedMedia.wim with the boot image stored in $BootImage, the distribution point stored in $DistributionPoint, the management point stored in $ManagementPoint, and the OS image stored in $OSImage.

$ManagementPoint = Get-CMManagementPoint -SiteSystemServerName "mp01.contoso.com" -SiteCode "CM1"
$BootImage = Get-CMBootImage -Name "BootImage01"
$DistributionPoint = Get-CMDistributionPoint -SiteSystemServerName "dist01.contoso.com" -SiteCode "CM1"
$OSImage = Get-CMOperatingSystemImage -Name "OSImagePkg01"

New-CMPrestageMedia -MediaMode Dynamic -Path "\\server\share\PrestagedMedia.wim" -BootImage $BootImage -DistributionPoint $DistributionPoint -ManagementPoint $ManagementPoint -OperatingSystemImage $OSImage

Parameters

-AllowUacPrompt

Add this parameter to allow Windows to prompt you to elevate your administrator permissions with User Account Control (UAC). This cmdlet requires elevated permissions to run.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-AllowUnattended

Add this parameter to allow an unattended OS deployment. An unattended OS deployment doesn't prompt for network configuration or optional task sequences.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-AllowUnknownMachine

Add this parameter to allow Configuration Manager to provision unknown computers. An unknown computer is a computer that the site hasn't discovered yet.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Application

Specify an array of application objects to include as part of the media file. If the task sequence references this content, it first looks locally for the content. If the content isn't in the media, the task sequence tries to download it from the network as normal. To get an application object, use the Get-CMApplication cmdlet.

Type:IResultObject[]
Aliases:Applications
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-BootImage

Specify a boot image object. To get this object, use the Get-CMBootImage cmdlet.

Type:IResultObject
Aliases:BootImagePackage
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-CertificateExpireTime

If you create a self-signed media certificate for HTTP communication, this parameter specifies the certificate's expiration date and time. Specify a datetime sufficiently in the future. When this certificate expires, you can't use the bootable media. Use the -CertificateStartTime parameter to set the start date.

For example:

$date = [datetime]::parseexact("11/16/2021", 'MM/dd/yyyy', $null)

Type:DateTime
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-CertificatePassword

If you use the -CertificatePath parameter to import a PKI certificate for HTTPS communication, use this parameter to specify the password for the certificate file.

Type:SecureString
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-CertificatePath

Specify the path to a PKI certificate to import. Use the -CertificatePassword parameter to specify the password for this certificate file. Use these parameters if you configure the site for HTTPS client communication.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-CertificateStartTime

To create a self-signed certificate for HTTP communication, this parameter specifies the certificate's start date and time. Use the -CertificateExpireTime parameter to set the expiration date. You can't use the bootable media until this date.

For example:

$date = [datetime]::parseexact("11/16/2020", 'MM/dd/yyyy', $null)

Type:DateTime
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Comment

An optional string to provide further details about the media. It's useful to describe how you configured or how you'll use this media. The maximum length is 127 characters.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-CreatedBy

An optional string to specify who created this media, which is useful for tracking purposes. The maximum length is 50 characters.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DisableWildcardHandling

This parameter treats wildcard characters as literal character values. You can't combine it with ForceWildcardHandling.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DistributionPoint

Specify one or more distribution point objects to which you distributed the content for this media. To get this object, use the Get-CMDistributionPoint cmdlet.

Type:IResultObject[]
Aliases:DistributionPoints
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-DriverPackage

Specify an array of driver package objects to include as part of the media file. If the task sequence references this content, it looks locally for the content. If the content isn't in the media, the task sequence tries to download it from the network as normal. To get this object, use the Get-CMDriverPackage cmdlet.

Type:IResultObject[]
Aliases:DriverPackages, PackageDriver, PackageDrivers
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Force

Run the command without asking for confirmation.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ForceWildcardHandling

This parameter processes wildcard characters and may lead to unexpected behavior (not recommended). You can't combine it with DisableWildcardHandling.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-IncludeApplicationDependency

Add this parameter to detect associated application dependencies and add them to this media.

Type:SwitchParameter
Aliases:IncludeApplicationDependencies
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ManagementPoint

Specify one or more management point objects that the media uses in initial communication. Use the -MediaMode parameter to determine how the media communicates when it runs. To get this object, use the Get-CMManagementPoint cmdlet.

Type:IResultObject[]
Aliases:ManagementPoints
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-MediaMode

Specify how the client finds a management point to get deployment information:

  • Dynamic: The media contacts a management point, which redirects the client to a different management point based on the client location in the site boundaries.

  • SiteBased: The media communicates the management point specified with the -ManagementPoint parameter.

Type:MediaMode
Accepted values:Dynamic, SiteBased
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-MediaPassword

Specify a secure string password to protect the task sequence media. When you boot a device with this media, you have to enter the password to continue.

Type:SecureString
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-NoAutoRun

Add this parameter to include the autorun.inf file on the media. Configuration Manager doesn't add it by default. This file is commonly blocked by antimalware products. For more information on the AutoRun feature of Windows, see Creating an AutoRun-enabled CD-ROM Application. If still necessary for your scenario, add this parameter to include the file.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-OperatingSystemImage

Specify an OS image package object to include for this media. Use the OperatingSystemImageIndex parameter to specify the image index in the image package. To get this object, use the Get-CMOperatingSystemImage cmdlet.

Type:IResultObject
Aliases:OperatingSystemImagePackage
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-OperatingSystemImageIndex

Specify the image index in the image package from the OperatingSystemImage parameter.

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Package

Specify an array of package objects to include in the media file. If the task sequence references this content, it looks locally for the content. If the content isn't in the media, the task sequence tries to download it from the network as normal. To get this object, use the Get-CMPackage cmdlet.

Type:IResultObject[]
Aliases:Packages
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Path

The path to the media file to create. The format is either a drive/directory path or a valid network path. For example:

  • C:\media\prestaged1.wim
  • \\server\share\prestaged1.wim
Type:String
Aliases:MediaPath, OutputPath, DriveName
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-PrestartCommand

Specify a command line to run before the task sequence starts. For more information, see Prestart commands for task sequence media.

Type:String
Aliases:PreExecCommandLine
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-PrestartPackage

If you specify a PrestartCommand, use this parameter to specify a package for prestart content if needed.

Type:IResultObject
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-SiteCode

Applies to version 2010 and later. Use this parameter with the ManagementPoint parameter to specify the site code.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-TaskSequence

Specify a task sequence object for this media to run. To get this object, use the Get-CMTaskSequence cmdlet.

Type:IResultObject
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-TemporaryFolder

The media creation process can require much temporary drive space. By default, Configuration Manager uses the temporary directory of the current user: $env:temp. For example, C:\Users\jqpublic\AppData\Local\Temp\. To give you greater flexibility with where to store these temporary files, specify a custom location for staging temporary data.

Type:String
Aliases:TemporaryDirectory, StagingArea
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-UserDeviceAffinity

To support user-centric management in Configuration Manager, specify how you want the media to associate users with the destination computer. For more information about how OS deployment supports user device affinity, see Associate users with a destination computer.

  • DoNotAllow: Don't allow user device affinity. The media doesn't associate users with the destination computer. In this scenario, the task sequence doesn't associate users with the destination computer when it deploys the OS.

  • AdministratorApproval: Allow user device affinity pending administrator approval. The media associates users with the destination computer after you grant approval. This functionality is based on the scope of the task sequence that deploys the OS. In this scenario, the task sequence creates a relationship between the specified users and the destination computer. It then waits for approval from an administrative user before it deploys the OS.

  • AutoApproval: Allow user device affinity with auto-approval. The media automatically associates users with the destination computer. This functionality is based on the actions of the task sequence that deploys the OS. In this scenario, the task sequence creates a relationship between the specified users and destination computer when it deploys the OS to the destination computer.

Type:UserDeviceAffinityType
Accepted values:DoNotAllow, AdministratorApproval, AutoApproval
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Variable

Specify a hashtable of task sequence variables to use during the task sequence deployment from this media.

Type:Hashtable
Aliases:TaskSequenceVariables, Variables
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Version

An optional string value to specify a version for this media, which is useful for tracking and revision purposes. The maximum length is 32 characters.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet doesn't run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

None

Outputs

System.Object

Notes

Cmdlet aliases: New-CMPrestagedMedia