My beta module so be gentle, I will definitely be going back and redoing the code. However right now it does work for up to 5 VMs.
It basically uses invoke-webrequest instead of having to download curl for Windows. A fun learning experience that I will
definitely be going back to perfect and fix.
Download Link:
https://www.dropbox.com/s/cp2ty9m28a2wyec/Vultr-v0.1.zip?dl=0
or get the latest version from here
https://gitlab.com/vektorprime/Vultr-PowerShell
Install instructions:
Extract the Vultr folder to
C:\Program Files\WindowsPowerShell\Modules
Your final path to the .psm1 file should be.
C:\Program Files\WindowsPowerShell\Modules\Vultr\Vultr.psm1
First go enable your API key at Vultr
Once you have your API key paste it somewhere or put it into a variable in powershell like so
Now you’re ready to get to work! You can use Get-VultrVM -api $api to get all your VMs
Or you can filter these VMs further so you can pass them along the pipeline like so.
In the above I used restart-vultrVM but you can also use other functions I’ve written like Stop-VultrVM, Start-VultrVM, heck there’s even a Remove-VultrVM (be careful)!
My favorite functions are Get-VultrPlanInRegion and New-VultrVM. These two functions should be used in conjunction with each other.
Use Get-VultrPLanInRegion -location ‘yourdatacenter’ to get all the available plans there. From there you can filter them on price, vcpus,ram,disk,disk type and then pipe the planid to New-VultrVM. Here’s an Example.
And one more screenshot of piping 3 VM objects to remove-vultrvm to delete VMs.
Have fun !