New-CMTSPartitionSetting

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

Syntax

New-CMTSPartitionSetting
   [-EnableDriveLetterAssignment <Boolean>]
   [-EnableQuickFormat <Boolean>]
   [-IsBootPartition <Boolean>]
   [-Name <String>]
   [-PartitionFileSystem <FileSystemType>]
   [-PartitionPrimary]
   [-Size <Int32>]
   [-SizeUnit <SizeUnitType>]
   [-Variable <String>]
   [-DisableWildcardHandling]
   [-ForceWildcardHandling]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-CMTSPartitionSetting
   [-Name <String>]
   [-PartitionEfi]
   [-Size <Int32>]
   [-SizeUnit <SizeUnitType>]
   [-DisableWildcardHandling]
   [-ForceWildcardHandling]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-CMTSPartitionSetting
   [-Name <String>]
   [-PartitionExtended]
   [-Size <Int32>]
   [-SizeUnit <SizeUnitType>]
   [-DisableWildcardHandling]
   [-ForceWildcardHandling]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-CMTSPartitionSetting
   [-Name <String>]
   [-PartitionHidden]
   [-Size <Int32>]
   [-SizeUnit <SizeUnitType>]
   [-DisableWildcardHandling]
   [-ForceWildcardHandling]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-CMTSPartitionSetting
   [-Name <String>]
   [-PartitionLogical]
   [-Size <Int32>]
   [-SizeUnit <SizeUnitType>]
   [-DisableWildcardHandling]
   [-ForceWildcardHandling]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-CMTSPartitionSetting
   [-Name <String>]
   [-PartitionMsr]
   [-Size <Int32>]
   [-SizeUnit <SizeUnitType>]
   [-DisableWildcardHandling]
   [-ForceWildcardHandling]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
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.

Type:SwitchParameter
Aliases:cf
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

-EnableDriveLetterAssignment

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

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

-EnableQuickFormat

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

Type:Boolean
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

-IsBootPartition

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

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

-Name

Specify a name for the partition.

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

-PartitionEfi

Add this parameter to make the partition type EFI.

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

-PartitionExtended

Add this parameter to make the partition type Extended.

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

-PartitionFileSystem

Specify the file system to format the partition.

Type:FileSystemType
Accepted values:Ntfs, Fat32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-PartitionHidden

Add this parameter to make the partition type Hidden.

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

-PartitionLogical

Add this parameter to make the partition type Logical.

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

-PartitionMsr

Add this parameter to make the partition type MSR.

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

-PartitionPrimary

Add this parameter to make the partition type Primary.

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

-PartitionRecovery

Add this parameter to make the partition type Recovery.

Type:SwitchParameter
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters: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.

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters: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.

Type:SizeUnitType
Accepted values:MB, GB, Percent
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters: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.

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

IResultObject

Notes

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