script to update categories and projects | Nutanix Community
Skip to main content
I have a bunch of VM (>300) converted from vmware, and I have to classify them with categories and projects.

I tried in powershell with the rest API, but when I GET the VM characteristics and use ConvertTo-Json to build new json file, it does not "expand" embedded arrays like disk_list, nic_list... so cannot send the PUT request correctly



Does someone have an example to set/update categories and project for a VM ?
I don't have a current cluster to test projects with however I have ran into this before with PowerShell and long embedded Json. With your ConvertTo-Json specify the Depth switch and put 10.



code:
$var | ConvertTo-Json -Depth 10




That should at least expand your GET Json per vm so you can see all the options/body.