< Back

Remove-AzureVMImage

Wed Jan 30, 2019 5:52 pm

NAME Remove-AzureVMImage



SYNOPSIS

Removes an operating system image from the image repository.





SYNTAX

Remove-AzureVMImage [-ImageName] <String> [[-DeleteVHD]] [-Profile <AzureSMProfile>] [-InformationAction <ActionPreference>] [-InformationVariable

<String>] [<CommonParameters>]





DESCRIPTION

The Remove-AzureVMImage cmdlet removes an operating system image from the image repository. By default, this cmdlet does not delete the associated

physical image blob from the storage account. To delete the associated virtual hard drive (VHD), use the DeleteVHD parameter.





PARAMETERS

-ImageName <String>

Specifies the operating system or virtual machine image to remove from the image repository.



Required? true

Position? 0

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-DeleteVHD [<SwitchParameter>]

Indicates that this cmdlet deletes the physical VHD image blob from the storage account.



Required? false

Position? 1

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-Profile <AzureSMProfile>

Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-InformationAction <ActionPreference>





Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-InformationVariable <String>





Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



NOTES









-------------------------- Example 1: Remove an image from the image repository --------------------------



PS C:\\>Remove-AzureVMImage -ImageName "Image001"



This command removes the image named Image001 from the image repository.

-------------------------- Example 2: Remove an image from the image repository and also the VHD --------------------------



PS C:\\>Remove-AzureVMImage -ImageName " Image001" -DeleteVHD



This command removes the image named Image001 from the image repository and also deletes the physical VHD image from the storage account.

-------------------------- Example 3: Set a subscription context and then remove all the images --------------------------



PS C:\\>$SubsId = &amp;lt;MySubscriptionID&amp;gt;

PS C:\\> $Cert = Get-AzureCertificate cert:\\LocalMachine\\MY\\&amp;lt;CertificateThumbprint&amp;gt;

PS C:\\>Get-AzureVMImage `

| Where-Object {$_.Label -match "Beta" }`

| Foreach-Object {Remove-AzureVMImage -ImageName $_.name }



This command sets the subscription context and then removes all the images from the image repository whose Label includes the name Beta.



RELATED LINKS

Add-AzureVMImage

Get-AzureVMImage

Save-AzureVMImage

Update-AzureVMImage