Question

Using powershell to query Prism

  • 13 October 2021
  • 2 replies
  • 109 views

I have started trying to use powershell 7 to perform queries against Prism Central.

I have been able to install powershell 7 as well as install the nutanix.cli module

I am able to establish a connection to a prism central instance.

Server                : server.domain.net
Version               : pc.2020.9.0.1
UserName              : account@domain
AcceptInvalidSSLCerts : True
ForcedConnection      : False

 

However when I try some basic commands such as get-cluster and get-vm I get the error

“Get-Cluster: Object reference not set to an instance of an object.”

 

If someone has an example of a script that works in there environment they can share I can see if I am doing something wrong.


2 replies

Badge

Sometimes this happens when the DLL’s do not load. I would try logging out and importing the module again.

ps> exit

ps> Import-Module Nutanix.Cli

 

Then try get-cluster again. 

Hi,

 

Sorry for the late response. Thank you for your response.

 

I did manage to solve the issue. The problem I am sure was a conflict with the same command used to query VMWare systems. so I think I was running the vSphere version of the get-cluster command

Once I was able to solve that the get-cluster command was working ok.

 

 

Reply