Powershell 如果Get-EC2Tag命令处于variable下,则无法打印结果

Powershell 如果Get-EC2Tag命令处于variable下,则无法打印结果,powershell,Powershell,$instanceId=(新对象System.Net.WebClient).DownloadString(“”) $tag=Get-EC2Tag-Filter@{Name=“resource type”;Value=“instance”},@{Name=“key”;Value=“Name”}|其中Object ResourceId-eq$instanceId |选择对象值|格式化表-HideTableHeaders 写入主机$tag这是写入主机$tag的结果 Microsoft.PowerShe

$instanceId=(新对象System.Net.WebClient).DownloadString(“”)

$tag=Get-EC2Tag-Filter@{Name=“resource type”;Value=“instance”},@{Name=“key”;Value=“Name”}|其中Object ResourceId-eq$instanceId |选择对象值|格式化表-HideTableHeaders
写入主机$tag

这是写入主机$tag的结果

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