Solved

Changing Project with powershell

  • 7 October 2019
  • 5 replies
  • 1417 views

Hi guys,

I'm somewhat new to Nutanix and I was curious if there was a powershell command that will allow you to set the project for a VM.

Essentially I want to use scripts to deploy VM's and then when the VM is deployed move it into a project so we can track resources.

The deployment part of this is easy enough, but nothing in powershell seems to indicate it can even do this.

Is this something that can even be done? I really like the powershell integration, and I really like the SSP Prism Central and Projects. I'd really really like to be able to use both of these together.

Thanks
icon

Best answer by Alona 10 October 2019, 07:15

View original

This topic has been closed for comments

5 replies

Userlevel 6
Badge +5
Hi @ITNINJA!

I am a big PowerShell fan myself and I can see how this option would help in streamlining VMs' deployment and assignment. I had a look at several resources:
I was not able to find any reference to projects in the first two options however there is projects option in Rest API v3.0

More on API versions Nutanix API versions – What are they and what does each one do?

Hope that helps.
Userlevel 4
Badge +5

Hello  @ITNINJA 

 @Alona answered the question beautifully. 

Just to add a new feature here of dev.nutanix.com API reference where you can generate code for the API requests. 
You can use the below-mentioned guide, select the generate code option after filling the required details(UUID of the entity in this scenario)  and select Powershell
https://www.nutanix.dev/reference/prism_central/v3/api/projects/putprojectsuuid 

With a little push in the right direction by Alona I was able to conjure something together.  Using a combination of Powershell and REST API.   

Thanks for the assist!

Userlevel 4
Badge +5

That's really nice to hear @ITNINJA 

Maybe you can write a post about how you wrote the scripts and help the community grow more?

 

Userlevel 6
Badge +5

@ITNINJA Glad I was able to help and that you made it work in the end!