![](/img/trans.png)
[英]Getting Azure information with Powershell about VNET, Subnet, NSG & route Table
[英]Powershell code to output azure VM, Name, Resource group, VNET, Subnet and NSG to excel?
有人可以建議我如何使用Powershell將Azure VMS詳細信息輸出到excel文件或文本文件嗎? 我需要VM,VNET,子網和NSG的名稱嗎?
您可以嘗試以下方式將VM詳細信息導出到excel。
$VMs = Get-AzureRmVM -ResourceGroupName "test" -Name "testVM" $vmOutput = $VMs | ForEach-Object { [PSCustomObject]@{ "VM Name" = $_.Name "VM Type" = $_.StorageProfile.osDisk.osType "VM Profile" = $_.HardwareProfile.VmSize "VM OS Disk Size" = $_.StorageProfile.OsDisk.DiskSizeGB "VM Data Disk Size" = ($_.StorageProfile.DataDisks.DiskSizeGB) -join ',' } } $vmOutput | export-csv C:\\Users\\test\\vmdata.csv -delimiter ";" -force -notypeinformation
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.