Skip to content

Instantly share code, notes, and snippets.

@duhaas2015
Created May 17, 2018 20:59
Show Gist options
  • Save duhaas2015/c4980d56db2927eb37c3eae1be5a8463 to your computer and use it in GitHub Desktop.
Save duhaas2015/c4980d56db2927eb37c3eae1be5a8463 to your computer and use it in GitHub Desktop.
$ErrorActionPreference = 'SilentlyContinue'
$vms = Get-VelosVM
$array = @()
$taskarray = @()
$vms | ForEach-Object {
$vm = $_
$tasks = $vm.ActiveTasks
if ($tasks){
$t = ''
$tasks | foreach {
$task = get-velostask -id $_ | where {$_.Type -ne 'FullMigration'}
if ($task){
$t = $task
}
}
if ($t){
$copy = ''
$ebscopy = ''
if ($t.type -eq 'MigrateToCloud'){
$copy = ($t.AdditionalInfo.MigrationProgressByteCount/$t.AdditionalInfo.MigrationTotalByteCount).tostring("P")
}
elseif ($t.type -eq 'PrepareToDetach'){
$ebscopy = ($t.AdditionalInfo.DetachProcessedRecords/$t.AdditionalInfo.DetachTotalRecords).tostring("P")
}
$tObject = ''
$tObject = [pscustomobject]@{
'Name' = $vm.VM
'TaskID' = $t.ID
'Type' = $t.type
'State' = $t.state
'Message' = $t.progressmessage
'Progress' = $t.progress
'Artisan to AWS' = $copy
'EBS Copy' = $ebscopy
}
$taskarray += $tObject
}
}
$vmi = get-velosvm $vm.id
$object = [pscustomobject]@{
'Name' = $vmi.vm
'AWSInstanceState' = $vmi.powerstate
'AWSInstanceStatus' = $vmi.cloudinfo.status.instancestatus.status
'AWSSystemStatus' = $vmi.cloudinfo.status.SystemStatus.status
'AWSInstanceID' = $vmi.cloudinfo.Id
'PrivateIP' = $vmi.cloudinfo.PrivateIpAddress
'InstanceType' = $vmi.CloudInfo.instancetype.name
}
$array += $object
}
$array | ft
$taskarray | ft
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment