Puede definir funciones de PowerShell para agregar y eliminar almacenes de datos.

En el siguiente ejemplo, las funciones de PowerShell agregan y eliminan un almacén de datos de un grupo automático.

# AddDatastoreToAutomaticPool
# Parameters
# 		$Pool Pool ID of pool to be updated.
# 		$Datastore Full path to datastore to be added.

function AddDatastoreToAutomaticPool
{ param ($Pool, $Datastore)
    $PoolSettings = (Get-Pool -pool_id $Pool)
    $datastores = $PoolSettings.datastorePaths + ";$Datastore"
    Update-AutomaticPool -pool_id $Pool -datastorePaths $datastores
}
Define a PowerShell function to remove a datastore from an automatic pool.

# RemoveDatastoreFromAutomaticPool
# Parameters
#    $Pool Pool ID of pool to be updated.
#    $Datastore Full path to datastore to be removed.

function RemoveDatastoreFromAutomaticPool
{ param ($Pool, $Datastore)
    $PoolSettings = (Get-Pool -pool_id $Pool)
    $currentdatastores = $PoolSettings.datastorePaths

    $datastores = ""
    foreach ($path in $currentdatastores.split(";")){
        if(-not ($path -eq $Datastore)){
            $datastores = $datastores + "$path;"
        }
    }
    Update-AutomaticPool -pool_id $Pool -datastorePaths $datastores
}

En el siguiente ejemplo, las funciones de PowerShell agregan un almacén de datos a un grupo de clonación vinculada y lo eliminan del mismo.

# AddDatastoreToLinkedClonePool
# Parameters
#   $Pool Pool ID of pool to be updated.
#   $Datastore Full path to datastore to be added.

function AddDatastoreToLinkedClonePool
{ param ($Pool, $Datastore)
    $PoolSettings = (Get-Pool -pool_id $Pool)
    $datastores = $PoolSettings.datastoreSpecs + ";$Datastore"
    Update-AutomaticLinkedClonePool -pool_id $Pool -datastoreSpecs $datastores
}

Define a PowerShell function to remove a datastore from a linked-clone pool.

# RemoveDatastoreFromLinkedClonePool
# Parameters
#   $Pool Pool ID of pool to be updated.
#   $Datastore Full path to datastore to be removed.

function RemoveDatastoreFromLinkedClonePool
{ param ($Pool, $Datastore)
    $PoolSettings = (Get-Pool -pool_id $Pool)
    $currentdatastores = $PoolSettings.datastoreSpecs

    $datastores = ""
    foreach ($spec in $currentdatastores.split(";")){
        $path = $spec.split("]")[1]
        $pathToRemove = $Datastore.split("]")[1]
        if(-not $pathToRemove){
            $pathToRemove = $Datastore
        }
        if(-not ($path -eq $pathToRemove)){
            $datastores = $datastores + "$spec;"
        }
    }
    Update-AutomaticLinkedClonePool -pool_id $Pool -datastoreSpecs $datastores
}