Vultr.com Module for Powershell | Create, Stop, Start, Restart, and Destroy Virtual Machines!

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

img 567f62894204d

Once you have your API key paste it somewhere or put it into a variable in powershell like so

img 567f630cc3c8d

 

Now you’re ready to get to work! You can use Get-VultrVM -api $api to get all your VMs

img 567f63b43e87b

Or you can filter these VMs further so you can pass them along the pipeline like so.

img 567f647aa90c3

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.

img 567f656192efb

And one more screenshot of piping 3 VM objects to remove-vultrvm to delete VMs.

img 568017adc1ed5

img 568017be82696

Have fun !

 

Leave a comment