VMware Cloud Community
TheVMinator
Expert
Expert
Jump to solution

Use PowerCLI to Update vROps

Now that vROps APIs fully support REST, and PowerShell supports REST, how can I take a power shell script and do something like:

  • import a list of virtual machines from a CSV file
  • access vROps using powerShell REST components
  • Create a custom group in vROps containing these VMs?

Thanks!

0 Kudos
1 Solution

Accepted Solutions
Tibmeister
Expert
Expert
Jump to solution

So you can use Invoke-RESTMethod to call the REST API.  From that, it returns a json type of object which can be parsed through ConvertFrom-JSON.  On the inverse, you should be able to use ConvertTo-JSON to create the command text to POST using Invoke-RESTMethod.

I personally haven't delved into this area yet and probably won't be able to, but I have used PowerShell a lot to do REST API interaction without difficulty so this should be no different.

View solution in original post

0 Kudos
2 Replies
Tibmeister
Expert
Expert
Jump to solution

So you can use Invoke-RESTMethod to call the REST API.  From that, it returns a json type of object which can be parsed through ConvertFrom-JSON.  On the inverse, you should be able to use ConvertTo-JSON to create the command text to POST using Invoke-RESTMethod.

I personally haven't delved into this area yet and probably won't be able to, but I have used PowerShell a lot to do REST API interaction without difficulty so this should be no different.

0 Kudos
TheVMinator
Expert
Expert
Jump to solution

ok thanks!

0 Kudos