Skip to content

Instantly share code, notes, and snippets.

@wcarroll
Last active April 3, 2019 02:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wcarroll/30a07b5a141d0a8f4743c352e9c34f58 to your computer and use it in GitHub Desktop.
Save wcarroll/30a07b5a141d0a8f4743c352e9c34f58 to your computer and use it in GitHub Desktop.
foreach ($volume in $VolumeList){
$volumeUri = "$VMSettingsUrl/volumes/$($volume.volumeIdentifier)"
$currentVolume = Invoke-RestMethod -Uri $volumeUri -Method GET -TimeoutSec 100 -Headers $ZertosessionHeader -ContentType $TypeJSON
$currentVolume.Datastore.DatastoreIdentifier = $newVMDS.DatastoreIdentifier
$body = $currentVolume | Convertto-Json -depth 10
$ChangeVolumeLocationRequest = Invoke-RestMethod -Uri $volumeUri -Method PUT -TimeoutSec 100 -Headers $ZertosessionHeader -ContentType $TypeJSON -Body $body
} #Close Volume Loop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment