Edit

Share via


Remove-IscsiServerTarget

Deletes the specified iSCSI target.

Syntax

TargetName (Default)

Remove-IscsiServerTarget
    [-TargetName] <String>
    [-ComputerName <String>]
    [-Credential <PSCredential>]
    [<CommonParameters>]

InputObject

Remove-IscsiServerTarget
    -InputObject <IscsiServerTarget>
    [-ComputerName <String>]
    [-Credential <PSCredential>]
    [<CommonParameters>]

Description

The Remove-IscsiServerTarget cmdlet deletes an iSCSI Target object. An iSCSI initiator cannot access the virtual disk after the target is deleted.

Examples

Example 1: Remove a target

PS C:\> Remove-IscsiServerTarget -Targetname "TargetOne"

This example deletes the target named TargetOne on the local server.

Example 2: Remove all targets on a server

PS C:\> $all = Get-IscsiServerTarget
PS C:\> ForEach-Object -InputObject ($each in $all) -Process {Remove-IscsiServerTarget -InputObject $each}

The example deletes all of the targets on the local server.

Parameters

-ComputerName

Specifies the computer name, or IP address, of the remote computer, if this cmdlet is run on a remote computer.

Specifies the cluster resource group network name, or cluster node name, if this cmdlet is run on a cluster configuration.

Parameter properties

Type:String
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:True
Value from remaining arguments:False

-Credential

Specifies the credentials when connecting to a remote computer.

Parameter properties

Type:PSCredential
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:True
Value from remaining arguments:False

-InputObject

Accepts an iSCSI Target object from the input pipeline.

Parameter properties

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

Parameter sets

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

-TargetName

Specifies the name of the iSCSI target.

Parameter properties

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

Parameter sets

TargetName
Position:0
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
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

Microsoft.Iscsi.Target.Commands.IscsiServerTarget

Outputs

None