解决了

如何列出仅属于某些项目的虚拟服务器名称?


徽章
  • 旅行者
  • 2个答复
如何列出仅属于某些项目的棱镜中央服务器。例如,仅列出属于项目“默认”的VM。

“ powerstate”表达名称是“ powerstate”,但是我应该用来调用“项目”名称的“项目”的相应名称是什么?

该脚本显示了VMNAME和POWERSTATE(违反Prism Central):
get-ntnxvm |选择 @{expression = {$_。vmname}; label =“ vmname”}, @{expression = {$ _。Powerstate}; label =“ powerstate”}
图标

最好的答案蒂莫西加莱2019年9月6日,20:39

\n
\nThese are all the properties that I see for a VM object:
\n
\n TypeName: Nutanix.Prism.DTO.Stats.VMDTO
\n
\nName MemberType Definition
\n---- ---------- ----------
\nEquals Method bool Equals(System.Object obj)
\nGetHashCode Method int GetHashCode()
\nGetType Method type GetType()
\nToString Method string ToString()
\nacropolisVm Property System.Nullable[bool] acropolisVm {get;set;}
\nalertSummary Property Nutanix.Prism.DTO.Alerts.AlertSummaryDTO alertSummary {get;set;}
\nclusterUuid Property string clusterUuid {get;set;}
\nconsistencyGroupName Property string consistencyGroupName {get;set;}
\ncontainerIds Property string[] containerIds {get;set;}
\ncontainerUuids Property string[] containerUuids {get;set;}
\ncontrolDomain Property System.Nullable[bool] controlDomain {get;set;}
\ncontrollerVm Property System.Nullable[bool] controllerVm {get;set;}
\ncpuReservedInHz Property System.Nullable[long] cpuReservedInHz {get;set;}
\ndescription Property string description {get;set;}
\ndiskCapacityInBytes Property System.Nullable[long] diskCapacityInBytes {get;set;}
\ndisplayable Property System.Nullable[bool] displayable {get;set;}
\nfingerPrintOnWrite Property string fingerPrintOnWrite {get;set;}
\ngpusInUse Property System.Nullable[bool] gpusInUse {get;set;}
\nguestOperatingSystem Property string guestOperatingSystem {get;set;}
\nhealthSummary Property Nutanix.Prism.DTO.Health.Check.HealthSummaryDTO healthSummary {get;set;}
\nhostId Property string hostId {get;set;}
\nhostName Property string hostName {get;set;}
\nhostUuid Property string hostUuid {get;set;}
\nhypervisorType Property string hypervisorType {get;set;}
\nipAddresses Property string[] ipAddresses {get;set;}
\nmemoryCapacityInBytes Property System.Nullable[long] memoryCapacityInBytes {get;set;}
\nmemoryReservedCapacityInBytes Property System.Nullable[long] memoryReservedCapacityInBytes {get;set;}
\nnonNdfsDetails Property string nonNdfsDetails {get;set;}
\nnumNetworkAdapters Property System.Nullable[long] numNetworkAdapters {get;set;}
\nnumVCpus Property System.Nullable[int] numVCpus {get;set;}
\nnutanixGuestTools Property Nutanix.Prism.DTO.Ngt.NutanixGuestToolsDTO nutanixGuestTools {get;set;}
\nnutanixVirtualDiskIds Property string[] nutanixVirtualDiskIds {get;set;}
\nnutanixVirtualDisks Property string[] nutanixVirtualDisks {get;set;}
\nnutanixVirtualDiskUuids Property string[] nutanixVirtualDiskUuids {get;set;}
\nonDiskDedup Property string onDiskDedup {get;set;}
\npowerState Property string powerState {get;set;}
\nprotectionDomainName Property string protectionDomainName {get;set;}
\nprotectionType Property string protectionType {get;set;}
\nrunningOnNdfs Property System.Nullable[bool] runningOnNdfs {get;set;}
\nstats Property System.Collections.Generic.Dictionary[string,string] stats {get;set;}
\nusageStats Property System.Collections.Generic.Dictionary[string,string] usageStats {get;set;}
\nuuid Property string uuid {get;set;}
\nvdiskFilePaths Property string[] vdiskFilePaths {get;set;}
\nvdiskNames Property string[] vdiskNames {get;set;}
\nvirtualNicIds Property string[] virtualNicIds {get;set;}
\nvirtualNicUuids Property string[] virtualNicUuids {get;set;}
\nvmId Property string vmId {get;set;}
\nvmName Property string vmName {get;set;}
\nvmType Property string vmType {get;set;}","className":"post__content__best_answer"}">
查看原件

3个答复

徽章
我看不到任何被列为名为“项目”的属性。

$ vm = get-ntnxvm < - 您的VM之一

$ vm |Get-Member < - 将列出所有可用的属性和方法。

或者

$ vm |选择 * < - 将列出所有内容和值。


-timg
徽章
我对命令不太熟悉。您能否将精确的脚本指向显示项目名称。最好的问候,Jani
徽章
我看不到项目名称的属性。我认为没有一个。

这些都是我为VM对象看到的所有属性:

类型:Nutanix.prism.dto.stats.vmdto

名称成员类型定义
--------------------------------------------
等于方法布尔等于(system.Object obj)
gethashcode方法int gethashcode()
getType方法类型getType()
Tostring方法字符串ToString()
Acropolisvm属性系统.nullable [bool] acropolisvm {get; set;}
Alertsummary属性Nutanix.prism.dto.alerts.alertsummarydto alertsummary {get; set; set;}
clusterUID属性字符串clusterUID {get; set;}
一致性groupname属性字符串consenencyGroupName {get; set;}
ContainerIds属性字符串[] containerIds {get; set;}
containeruids属性字符串[] containeruuids {get; set;}
controldomain属性系统。可享用[bool] controldomain {get; set;}
contrantervm属性系统.nullable [bool] contrantervm {get; set;}
cpuresEvervedInhz属性系统。
描述属性字符串描述{get; set;}
diskcapacityInbytes属性system.nullable [long] diskcapacityInbytes {get; set;}
可显示的属性系统。可否则[bool]可显示{get; set;}
FingerPrintonWrite属性字符串FingerPrintonWrite {get; set;}
gpusinuse属性系统.nullable [bool] gpusinuse {get; set;}
GuestOperatingSystem属性字符串guestOperatingSystem {get; set;}
Healthsummary Property Nutanix.prism.dto.health.check.check.healthsummarydto healthsummary {get; set; set;}
hostid属性字符串hostid {get; set;}
主机名属性字符串主机名{get; set;}
hostuuid属性字符串hostuID {get; set;}
HyperVisortype属性字符串hypervisortype {get; set;}
ipaddresses属性字符串[] ipaddresses {get; set;}
memorycapacityInbytes属性system.nullable [long] memorycapacitybytesinbytes {get; set;}
memory ReservedCapacityInbytes属性系统.Nullable [long] memory ReservevercapacityBytesInbytes {get; set; set;}
nonndfsdetails属性字符串nonndfsdetails {get; set;}
numnetworkAdapters属性系统.nullable [long] numnetworkadapters {get; set;}
numvcpus属性system.nullable [int] numvcpus {get; set;}
nutanixguesttools属性nutanix.prism.dto.ngt.nutanixguesttoolsdto nutanixguesttools {get; set; set;}
nutanixvirtualdiskids属性字符串[] nutanixvirtualdiskids {get; set;}
nutanixvirtualdisks属性字符串[] nutanixvirtualdisks {get; set;}
nutanixvirtualdiskuuids属性字符串[] nutanixvirtualdiskuuids {get; set;}
onDiskDedup属性字符串ondiskdedup {get; set;}
powerstate属性字符串powerstate {get; set;}
protectionDomainName属性字符串propectionDomainName {get; set;}
protectionType属性字符串propectionType {get; set;}
RunnorOnndfs属性system.nullable [bool] runnononndfs {get; set; set;}
stats属性system.collections.generic.dictionary [string,string] stats {get; set; set;}
usagestats属性system.collections.generic.dictionary [string,string] usageStats {get; set; set;}
uuid属性字符串uuid {get; set;}
vdiskfilepaths属性字符串[] vdiskfilepaths {get; set;}
vdisknames属性字符串[] vdisknames {get; set;}
virtualnicids属性字符串[] virtualnicids {get; set;}
VirtualNicuuids属性字符串[] virtualNicuuids {get; set;}
VMID属性字符串VMID {get; set;}
vmname属性字符串vmname {get; set;}
vmtype属性字符串vmtype {get; set;}

回复


Learn more about our cookies.<\/a>","cookiepolicy.button":"Accept cookies","cookiepolicy.button.deny":"Deny all","cookiepolicy.link":"Cookie settings","cookiepolicy.modal.title":"Cookie settings","cookiepolicy.modal.content":"We use 3 different kinds of cookies. You can choose which cookies you want to accept. We need basic cookies to make this site work, therefore these are the minimum you can select. Learn more about our cookies.<\/a>","cookiepolicy.modal.level1":"Basic
Functional","cookiepolicy.modal.level2":"Normal
Functional + analytics","cookiepolicy.modal.level3":"Complete
Functional + analytics + social media + embedded videos"}}}">
Baidu