Amazon web services 用于显示服务器名称的AWS EC2 Powershell命令/脚本
Powershell不是我的强项,但我正在努力。说到这里,我发现这个命令提供了我需要的关于AWS EC2实例的大部分信息,但是它缺少服务器的实际名称。有人知道如何修改它以获得要显示的名称吗?提前谢谢 (Get-EC2Instance)。实例尝试:Amazon web services 用于显示服务器名称的AWS EC2 Powershell命令/脚本,amazon-web-services,powershell,amazon-ec2,Amazon Web Services,Powershell,Amazon Ec2,Powershell不是我的强项,但我正在努力。说到这里,我发现这个命令提供了我需要的关于AWS EC2实例的大部分信息,但是它缺少服务器的实际名称。有人知道如何修改它以获得要显示的名称吗?提前谢谢 (Get-EC2Instance)。实例尝试: (Get-EC2Instance).Instances.PublicDnsName 您可以使用命令get member查看所有可用属性: PS C:\Users\mine> (Get-EC2Instance).Instances | get-m
(Get-EC2Instance).Instances.PublicDnsName
您可以使用命令get member
查看所有可用属性:
PS C:\Users\mine> (Get-EC2Instance).Instances | get-member
Name MemberType Definition
---- ---------- ----------
Tag AliasProperty Tag = Tags
Equals Method bool Equals(System.Object obj)
GetHashCode Method int GetHashCode()
GetType Method type GetType()
ToString Method string ToString()
AmiLaunchIndex Property int AmiLaunchIndex {get;set;}
Architecture Property Amazon.EC2.ArchitectureValues Architecture {get;set;}
BlockDeviceMappings Property System.Collections.Generic.List[Amazon.EC2.Model.InstanceBlockDeviceMapping] BlockDeviceMappings {get;set;}
ClientToken Property string ClientToken {get;set;}
CpuOptions Property Amazon.EC2.Model.CpuOptions CpuOptions {get;set;}
EbsOptimized Property bool EbsOptimized {get;set;}
ElasticGpuAssociations Property System.Collections.Generic.List[Amazon.EC2.Model.ElasticGpuAssociation] ElasticGpuAssociations {get;set;}
EnaSupport Property bool EnaSupport {get;set;}
Hypervisor Property Amazon.EC2.HypervisorType Hypervisor {get;set;}
IamInstanceProfile Property Amazon.EC2.Model.IamInstanceProfile IamInstanceProfile {get;set;}
ImageId Property string ImageId {get;set;}
InstanceId Property string InstanceId {get;set;}
InstanceLifecycle Property Amazon.EC2.InstanceLifecycleType InstanceLifecycle {get;set;}
InstanceType Property Amazon.EC2.InstanceType InstanceType {get;set;}
KernelId Property string KernelId {get;set;}
KeyName Property string KeyName {get;set;}
LaunchTime Property datetime LaunchTime {get;set;}
Monitoring Property Amazon.EC2.Model.Monitoring Monitoring {get;set;}
NetworkInterfaces Property System.Collections.Generic.List[Amazon.EC2.Model.InstanceNetworkInterface] NetworkInterfaces {get;set;}
Placement Property Amazon.EC2.Model.Placement Placement {get;set;}
Platform Property Amazon.EC2.PlatformValues Platform {get;set;}
PrivateDnsName Property string PrivateDnsName {get;set;}
PrivateIpAddress Property string PrivateIpAddress {get;set;}
ProductCodes Property System.Collections.Generic.List[Amazon.EC2.Model.ProductCode] ProductCodes {get;set;}
PublicDnsName Property string PublicDnsName {get;set;}
PublicIpAddress Property string PublicIpAddress {get;set;}
RamdiskId Property string RamdiskId {get;set;}
RootDeviceName Property string RootDeviceName {get;set;}
RootDeviceType Property Amazon.EC2.DeviceType RootDeviceType {get;set;}
SecurityGroups Property System.Collections.Generic.List[Amazon.EC2.Model.GroupIdentifier] SecurityGroups {get;set;}
SourceDestCheck Property bool SourceDestCheck {get;set;}
SpotInstanceRequestId Property string SpotInstanceRequestId {get;set;}
SriovNetSupport Property string SriovNetSupport {get;set;}
State Property Amazon.EC2.Model.InstanceState State {get;set;}
StateReason Property Amazon.EC2.Model.StateReason StateReason {get;set;}
StateTransitionReason Property string StateTransitionReason {get;set;}
SubnetId Property string SubnetId {get;set;}
Tags Property System.Collections.Generic.List[Amazon.EC2.Model.Tag] Tags {get;set;}
VirtualizationType Property Amazon.EC2.VirtualizationType VirtualizationType {get;set;}
VpcId Property string VpcId {get;set;}
我能够运行下面的命令并得到所需的结果 实例|选择InstanceId、PublicDnsName、PrivateIpAddress、RootDeviceName、RootDeviceType、ImageId、@{Name=“AWS Servername”;表达式={$\标签|其中key-eq“Name”|选择值-扩展值}|输出GridView
谢谢你的帮助 请阅读,并请。您的预期输出是什么?你的结果如何?发布完整的代码示例