如何在 table powershell 中显示可用位置
How to Display available locations in a table powershell
您好,我使用 PowerShell 命令 Get-AzureRmLocation
从 azure 中列出可用位置。我想以 table 或某种格式良好的方式整齐地显示它们,而不是逐行列出它们。
我试过了
$locations = @(Get-AzureRmLocation | Select-Object -ExpandProperty DisplayName)
Write-Host -ForegroundColor Yellow "Available Locations :"
$locations | Format-Table
但这也列出了所有让屏幕看起来很长而且不太好看的东西。有办法吗?
我得到的输出是这样的列表https://imgur.com/a/MjstD
我希望它是一个包含所有可用位置的两 table 列。
谢谢
这是你想要的吗?
$locations = Get-AzureRmLocation
$locations | Format-Table @{n="Available Locations";e={$_.DisplayName}}
也许你可以试试下面的例子:
$locations = Get-AzureRmLocation
$locations | Format-Table -Property Location,DisplayName
我在我的实验室测试,得到如下结果:
要列出所有 Azure 位置,我建议使用 Get-AzLocation
Get-AzLocation | Format-Table -Property Location, DisplayName
结果:
PowerShell 版本:
您好,我使用 PowerShell 命令 Get-AzureRmLocation
从 azure 中列出可用位置。我想以 table 或某种格式良好的方式整齐地显示它们,而不是逐行列出它们。
我试过了
$locations = @(Get-AzureRmLocation | Select-Object -ExpandProperty DisplayName)
Write-Host -ForegroundColor Yellow "Available Locations :"
$locations | Format-Table
但这也列出了所有让屏幕看起来很长而且不太好看的东西。有办法吗?
我得到的输出是这样的列表https://imgur.com/a/MjstD
我希望它是一个包含所有可用位置的两 table 列。 谢谢
这是你想要的吗?
$locations = Get-AzureRmLocation
$locations | Format-Table @{n="Available Locations";e={$_.DisplayName}}
也许你可以试试下面的例子:
$locations = Get-AzureRmLocation
$locations | Format-Table -Property Location,DisplayName
我在我的实验室测试,得到如下结果:
要列出所有 Azure 位置,我建议使用 Get-AzLocation
Get-AzLocation | Format-Table -Property Location, DisplayName
结果:
PowerShell 版本: