有谁知道如何通过Azure PowerShell获取Azure中虚拟机的Mac地址?我知道我可以使用 WMI 或 VM 中的其他东西来获取它,但我不知道如何在不登录 VM 的情况下做到这一点。
使用 Get-AzureRmNetworkInterface
命令和生成的对象具有的 MacAddress
属性:
(Get-AzureRmNetworkInterface -ResourceGroupName %rgName%).MacAddress
这将列出资源组中网络接口的所有 MAC,更具体地说,您可以添加 -Name
参数。
(Get-AzureRmNetworkInterface -ResourceGroupName %rgName% -Name %nicName%).MacAddress