Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@timothywarner
Created December 8, 2017 17:44
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 timothywarner/8cfa77841ac288a4533b071a3b809626 to your computer and use it in GitHub Desktop.
Save timothywarner/8cfa77841ac288a4533b071a3b809626 to your computer and use it in GitHub Desktop.
Get-ARMVM
function Get-ARMVM
{
$RGs = Get-AzureRMResourceGroup
foreach($RG in $RGs)
{
$VMs = Get-AzureRmVM -ResourceGroupName $RG.ResourceGroupName
foreach($VM in $VMs)
{
$VMDetail = Get-AzureRmVM -ResourceGroupName $RG.ResourceGroupName -Name $VM.Name -Status
$RGN = $VMDetail.ResourceGroupName
foreach ($VMStatus in $VMDetail.Statuses)
{
$VMStatusDetail = $VMStatus.DisplayStatus
}
Write-Output "Resource Group: $RGN", ("VM Name: " + $VM.Name), "Status: $VMStatusDetail" `n
}
}
}
@jkarthik9884
Copy link

Hello I have tried it using with the help of run book and started testing but it gives output as "This job does not have any output".

Is there any way to use this script?

@jkarthik9884
Copy link

I have pasted in runbook and tested after saving it. It shows completed but, not given any output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment