Private/Remove-eiSCSIFavoriteTarget.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
function Remove-eiSCSIFavoriteTarget {
    param(
        [Parameter(ValueFromPipelineByPropertyName, Mandatory)]
        [string] $SessionIdentifier
    )

    process {
        $wmiResponse = Get-WmiObject -Class MSFT_iSCSISession -Namespace ROOT/Microsoft/Windows/Storage | Where-Object {$_.SessionIdentifier -eq $SessionIdentifier}
        $wmiResponse = $wmiResponse.Unregister()

        return $wmiResponse
    }
}