Script for gathering Azure Vm info (VmSize incl.) RRS feed

  • Question

  • Hi All,

    For my customer I need to get an export of current Azure VM's. I made a script, but when I put in Select-Object "VmSize", it does not export. How can I add Select-Object VmSize to see this information? When I use Get-AzureRmVM, it shows the VmSize...see the picture: 

    My current script:

    # Variables for Path and Filename. 
    $Path = "c:\temp"
    $Filename = "$Path\AllAzureVM.CSV"

    # Get-AzureRmSubscription

    # Select Azure Subscription
    Select-AzureRmSubscription -SubscriptionName "Allego Pre-Prod"

    # Get the Azure users and export to CSV
    Get-AzureRmVM | Select-Object resourcegroupname,name,location,ProvisioningState,StatusCode | Export-Csv $Filename -NoTypeInformation
    Friday, March 9, 2018 10:25 AM


All replies