共用方式為


Remove-AzureVMImage

[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

Remove-AzureVMImage

Removes an operating system image from the Image Repository.

Syntax

Parameter Set: Default
Remove-AzureVMImage [-ImageName] <String> [[-DeleteVHD]] [ <CommonParameters>]

Detailed Description

This topic describes the cmdlet in the 0.8.10 version of the Microsoft Azure PowerShell module. To get the version of the module you're using, in the Azure PowerShell console, type (Get-Module -Name Azure).Version.

The Remove-AzureVMImage cmdlet removes an operating system image from the image repository. By default, this cmdlet doesn’t delete the associated physical image blob from the storage account. To delete the associated VHD, use the DeleteVHD parameter.

Parameters

-DeleteVHD

When specified, deletes the physical VHD image blob from the storage account.

Aliases

none

Required?

false

Position?

2

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ImageName<String>

Specifies the operating system image to remove from the image repository.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see  about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

Outputs

The output type is the type of the objects that the cmdlet emits.

Examples

Example 1

This command removes the "MyOSImage" image from the image repository.

C:\PS>Remove-AzureVMImage -ImageName MyOSImage

Example 2

This command removes the "MyOSImage" image from the image repository and also deletes the physical VHD image from the storage account.

C:\PS>Remove-AzureVMImage -ImageName MyOSImage –DeleteVHD 

Example 3

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

C:\PS>$subsId = <MySubscriptionID>C:\PS>$cert = Get-AzureCertificate cert:\LocalMachine\MY\<CertificateThumbprint>C:\PS>Get-AzureVMImage `| Where-Object {$_.Label -match "Beta" }`| Foreach-Object {Remove-AzureVMImage –ImageName $_.name } 

Add-AzureVMImage

Get-AzureVMImage

Update-AzureVMImage