Given below command giving the output as object
$output = (Invoke-AzVMRunCommand -ResourceGroupName $rgname -Name $vmname -CommandId 'RunPowerShellScript' -ScriptPath authoring.ps1).value
Output
Mode : Process
ContextDirectory :
ContextFile :
CacheDirectory :
CacheFile :
Settings : {}
Code : ComponentStatus/StdOut/succeeded
Level : Info
DisplayStatus : Provisioning succeeded
Message : @{cluster_name=test01; status=green; timed_out=False; number_of_nodes=3;
number_of_data_nodes=3;
active_primary_shards=25; active_shards=50; relocating_shards=0;
initializing_shards=0;
unassigned_shards=0; delayed_unassigned_shards=0; number_of_pending_tasks=0;
number_of_in_flight_fetch=0; task_max_waiting_in_queue_millis=0;
active_shards_percent_as_number=100.0}
Time :
Code : ComponentStatus/StdErr/succeeded
Level : Info
DisplayStatus : Provisioning succeeded
How to get the Message ==> number_of_nodes = 3 and number_of_data_nodes=3 in some variable so based on this value I need to perform some action. Thanks
$output.Message.GetType()
reveal? – Theo$output.Message.number_of_nodes
Should give you what you need – Otter