Edit

Share via


New-CMTSPartitionSetting

Create a disk partition object to use with the Format and Partition Disk task sequence step.

Syntax

PrimaryPartition (Default)

New-CMTSPartitionSetting
    [-EnableDriveLetterAssignment <Boolean>]
    [-EnableQuickFormat <Boolean>]
    [-IsBootPartition <Boolean>]
    [-Name <String>]
    [-PartitionFileSystem <FileSystemType>]
    [-PartitionPrimary]
    [-Size <Int32>]
    [-SizeUnit <SizeUnitType>]
    [-Variable <String>]
    [-DisableWildcardHandling]
    [-ForceWildcardHandling]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

EfiPartition

New-CMTSPartitionSetting
    [-Name <String>]
    [-PartitionEfi]
    [-Size <Int32>]
    [-SizeUnit <SizeUnitType>]
    [-DisableWildcardHandling]
    [-ForceWildcardHandling]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

ExtendedPartition

New-CMTSPartitionSetting
    [-Name <String>]
    [-PartitionExtended]
    [-Size <Int32>]
    [-SizeUnit <SizeUnitType>]
    [-DisableWildcardHandling]
    [-ForceWildcardHandling]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

HiddenPartition

New-CMTSPartitionSetting
    [-Name <String>]
    [-PartitionHidden]
    [-Size <Int32>]
    [-SizeUnit <SizeUnitType>]
    [-DisableWildcardHandling]
    [-ForceWildcardHandling]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

LogicalPartition

New-CMTSPartitionSetting
    [-Name <String>]
    [-PartitionLogical]
    [-Size <Int32>]
    [-SizeUnit <SizeUnitType>]
    [-DisableWildcardHandling]
    [-ForceWildcardHandling]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

MsrPartition

New-CMTSPartitionSetting
    [-Name <String>]
    [-PartitionMsr]
    [-Size <Int32>]
    [-SizeUnit <SizeUnitType>]
    [-DisableWildcardHandling]
    [-ForceWildcardHandling]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

RecoveryPartition

New-CMTSPartitionSetting
    [-Name <String>]
    [-PartitionRecovery]
    [-Size <Int32>]
    [-SizeUnit <SizeUnitType>]
    [-DisableWildcardHandling]
    [-ForceWildcardHandling]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

This cmdlet creates a disk partition object to use with the Format and Partition Disk task sequence step. Use this cmdlet to define the partition settings, and then use that object with the -PartitionSetting parameter of the New-CMTSStepPartitionDisk or Set-CMTSStepPartitionDisk cmdlets.

You can create the following types of partition settings objects, based on the switch parameter that you use with this cmdlet:

  • PartitionPrimary: Primary partition
  • PartitionEfi EFI partition
  • PartitionExtended: Extended partition
  • PartitionHidden: Hidden partition
  • PartitionLogical: Logical partition
  • PartitionMsr: MSR partition
  • PartitionRecovery: Recovery partition

If you don't specify a partition switch parameter, the cmdlet creates a primary partition settings object.

For more information, see Format and Partition Disk: Volume.

Examples

Example 1: Create settings for an EFI partition

This example creates settings for an EFI partition that's 500 MB and saves it as the partEfi variable.

$partEfi = New-CMTSPartitionSetting -Name "EFI" -PartitionEfi -Size 500 -SizeUnit MB

Example 2: Create settings for an MSR partition

This example creates settings for an MSR partition that's 128 MB and saves it as the partMsr variable.

$partMsr = New-CMTSPartitionSetting -Name "MSR" -PartitionMsr -Size 128 -SizeUnit MB

Example 3: Create settings for a Windows primary partition

This example creates settings for a Windows primary partition and saves it as the partWin variable.

$partWin = New-CMTSPartitionSetting -Name "Windows" -PartitionPrimary -Size 99 -SizeUnit Percent -EnableDriveLetterAssignment $true -EnableQuickFormat $true -PartitionFileSystem NTFS -IsBootPartition $true

Example 4: Create settings for a recovery partition

This example creates settings for a Recovery partition that's 100% of the remaining disk space and saves it as the partMsr variable.

$partRec = New-CMTSPartitionSetting -Name "Recovery" -PartitionRecovery -Size 100 -SizeUnit Percent

Example 5: View the partition setting details for a step

This example first gets a task sequence object in the $tsOsd variable. It then passes that variable as the input object to get the Format and Partition Disk step.

Then to view the first partition settings, reference the Partitions property, which is an array of SMS_TaskSequence_PartitionSettings objects.

$tsNameOsd = "Default OS deployment"
$tsOsd = Get-CMTaskSequence -Name $tsNameOsd -Fast

$tsStepNameFormatDisk = "Partition Disk 0 - UEFI"
$tsStepFormatDisk = Get-CMTSStepPartitionDisk -InputObject $tsOsd -StepName $tsStepNameFormatDisk

$tsStepFormatDisk.Partitions[0]

You can use this process to copy partition settings between steps or task sequences. Save this partition settings object as a variable and then add it to another step.

Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DisableWildcardHandling

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

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-EnableDriveLetterAssignment

Set this parameter to true to let Configuration Manager assign a drive letter to the partition.

Parameter properties

Type:Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

PrimaryPartition
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-EnableQuickFormat

Set this parameter to true to let Configuration Manager do a quick format of the partition.

Parameter properties

Type:Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

PrimaryPartition
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ForceWildcardHandling

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

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-IsBootPartition

Set this parameter to true to make this partition the boot partition.

Parameter properties

Type:Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

PrimaryPartition
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Name

Specify a name for the partition.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:PartitionName, VolumeName

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-PartitionEfi

Add this parameter to make the partition type EFI.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

EfiPartition
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-PartitionExtended

Add this parameter to make the partition type Extended.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ExtendedPartition
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-PartitionFileSystem

Specify the file system to format the partition.

Parameter properties

Type:FileSystemType
Default value:None
Accepted values:Ntfs, Fat32
Supports wildcards:False
DontShow:False

Parameter sets

PrimaryPartition
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-PartitionHidden

Add this parameter to make the partition type Hidden.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

HiddenPartition
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-PartitionLogical

Add this parameter to make the partition type Logical.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

LogicalPartition
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-PartitionMsr

Add this parameter to make the partition type MSR.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

MsrPartition
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-PartitionPrimary

Add this parameter to make the partition type Primary.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

PrimaryPartition
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-PartitionRecovery

Add this parameter to make the partition type Recovery.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

RecoveryPartition
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Size

Specify an integer value for the size of the partition. Use this parameter with the -SizeUnit parameter. If -SizeUnit is Percent, then specify a number between 1-100 for this parameter. If -SizeUnit is MB or GB, specify a number for the specific partition size.

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-SizeUnit

Specify the unit type for the size. Use this parameter with the -Size parameter.

  • Percent: Use -Size to set the partition to a percentage of remaining free space on the disk.

  • MB or GB: Use -Size to set a specific size for the partition.

Parameter properties

Type:SizeUnitType
Default value:None
Accepted values:MB, GB, Percent
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Variable

By default, Configuration Manager assigns the next available drive letter to this partition. To save this drive letter for future use, set a custom task sequence variable with this parameter.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

PrimaryPartition
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-WhatIf

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

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

None

Outputs

IResultObject

Notes

For more information on this return object and its properties, see SMS_TaskSequence_PartitionSettings server WMI class.