Remove-IscsiServerTarget

Deletes the specified iSCSI target.

Syntax

Remove-IscsiServerTarget
      [-TargetName] <String>
      [-ComputerName <String>]
      [-Credential <PSCredential>]
      [<CommonParameters>]
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.

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

-Credential

Specifies the credentials when connecting to a remote computer.

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

-InputObject

Accepts an iSCSI Target object from the input pipeline.

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

-TargetName

Specifies the name of the iSCSI target.

Type:String
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

Inputs

Microsoft.Iscsi.Target.Commands.IscsiServerTarget

Outputs

None