# encoding: ascii
# api: powershell
# title: Step03b-Move-datastore-t
# description: Script to create Datastore clusters and add datastores from csv
# version: 0.1
# type: script
# author: Leon Scheltema
# license: CC0
# x-poshcode-id: 5667
# x-archived: 2015-01-15T20:03:30
# x-published: 2015-01-07T13:39:00
#
#
# Script to create Datastore clusters and add datastores from csv
# By Leon Scheltema AVANCE ICT Groep Nederland

# Begin variables
$VC1 = "New vCenter"
$DSCluster = "Datastore Cluster"
# End variables

# Connect to vCenter server
Connect-VIServer "$VC1"

Set-DatastoreCluster -DatastoreCluster $DSCluster -SdrsAutomationLevel FullyAutomated

Import-CSV $DSCluster.csv | ForEach-Object {

	$Datastore = $_.Name

move-datastore -Datastore $Datastore -Destination $DSCluster

# Disconnect from vCenter server
Disconnect-VIServer -server "$VC1" -Force -Confirm:$false
