- Authenticates to Prism Central V3 API
- Calls /category/query API to get a list of VM uuid's that are members of the PROD category.
- Write this list of uuid's to a string
- Connect to the NTNX cluster using Nutanix PowerShell cmdlets.
- Iterate through the above string and execute Set-NTNXVMPowerState against the uuid's.
Once the script gives the error, the powershell connection looks like it locks the account and you cannot execute any commands.
If I comment out the foreach loop, and just execute a normal PoSH cmdlet (after the Connect-NTNXCluster) such as Get-NTNXClusterInfo, it works fine.
I have tried both my account (which has Prism admin rights) and the Prism Central admin account with no luck.
So 2 questions:
- Any ideas what the problem is with the code?
- Would there be any issues with the starter license in executing Set-NTNX* commands?
https://github.com/leepryor/Nutanix_Powershell/blob/master/Shutdown-Categorized-VMs.ps1