Skip to main content

Remove-CPCCustomImage

SYNOPSIS​

Removes a Cloud PC Custom Image

SYNTAX​

Remove-CPCCustomImage [-Name] <String> [[-Version] <String>] [-ProgressAction <ActionPreference>] [-WhatIf]
[-Confirm] [<CommonParameters>]

DESCRIPTION​

The function will remove a Cloud PC Custom Image. The name must match the display name of exactly one image (exact match, not case sensitive). Several versions of an image can share a display name; use -Version to select one of them. If no image or more than one image matches, nothing is removed and the command stops; the message lists the id and version of every match. The function asks for confirmation before it removes the image. In a non-interactive session (pwsh -File, a pipeline or a scheduled task) the confirmation prompt fails and nothing is removed, so pass -Confirm:$false there.

EXAMPLES​

EXAMPLE 1​

Remove-CPCCustomImage -name "Custom Image 01"

EXAMPLE 2​

Remove-CPCCustomImage -name "Custom Image 01" -Version "1.0.0"

EXAMPLE 3​

Remove-CPCCustomImage -name "Custom Image 01" -WhatIf

EXAMPLE 4​

Remove-CPCCustomImage -name "Custom Image 01" -Version "1.0.0" -Confirm:$false

Removes the image without asking for confirmation, as needed in scripts and pipelines.

PARAMETERS​

-Name​

Enter the name of the Cloud PC Custom Image

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Version​

Enter the version of the Cloud PC Custom Image (for example "1.0.0"). Optional; only needed when more than one image has the same name.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-WhatIf​

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi

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

-Confirm​

Prompts you for confirmation before running the cmdlet.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf

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

-ProgressAction​

Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by Write-Progress.

Type: ActionPreference
Parameter Sets: (All)
Aliases: proga

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

CommonParameters​

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

INPUTS​

OUTPUTS​

NOTES​

Required permission: CloudPC.ReadWrite.All https://learn.microsoft.com/graph/api/cloudpcdeviceimage-delete?view=graph-rest-beta https://learn.microsoft.com/graph/api/virtualendpoint-list-deviceimages?view=graph-rest-beta https://learn.microsoft.com/graph/api/resources/cloudpcdeviceimage?view=graph-rest-beta