首页 > 解决方案 > 如果 Get-EC2Tag 命令在变量下,则无法打印结果

问题描述

$instanceId = (New-Object System.Net.WebClient).DownloadString(" http://169.254.169.254/latest/meta-data/instance-id" )

$tag = Get-EC2Tag -Filter @{Name="resource-type";Value="instance"},@{Name="key";Value="Name"} | Where-Object ResourceId -eq $instanceId | 选择对象值 | Format-Table -HideTableHeaders Write-Host $tag

标签: powershell

解决方案


这是 Write-Host $tag 的结果

Microsoft.PowerShell.Commands.Internal.Format.FormatStartData Microsoft.PowerShell.Commands.Internal.Format.GroupStartData Microsoft.PowerShell.Commands.Internal.Format.FormatEntryData Microsoft.PowerShell.Commands.Internal.Format.GroupEndData Microsoft.PowerShell.Commands。 Internal.Format.FormatEndData


推荐阅读