Automating MyCloudSpace with our new API key authorisation

mycloudspace Jun 22, 2021

Our MyCloudSpace 2020 Q4 release brought API Key authorisation helping our clients and partners integrate easier with their cloud services.

We have had a git repository with some powershell examples for a while but this was using the two-factor enabled login which adds complexity when you are wanting to integrate machine-to-machine.

I have just added API key examples of the same Snapshot and Power off/Cost Saving overnight scripts to this repository. They are two common use cases we see for our clients wanting to consume our API.

If you don't have an API key for MyCloudSpace just get in touch with us.

Let's take a look at these in action;

Power off/on and reconfigure environment

You will need to fill in the Server List section as well as populating your API key and username.

Example server list:

 $vmList =

You will feed the MyCloudSpace server name into the script as well as the specification you want the machine to be where it is powered on. When we power the machine off this script de-specs the machine down to 1 core/socket and 1gb to give you the best cost savings when not in use. Then the reverse when it comes back up and puts your desired spec back in.

Run the command with the mode (on / off)

.\ChangePowerAndSpecOfEnvironment.ps1 -mode off
Example log running the power off with 3 servers

You can see above it performs a nice shutdown of the server then de-specs it. You can see these actions in the audit log as well as all actions are logged against your user/account.

And if we perform the reverse (on) then you will see a similar log but this time putting the cores/sockets and memory back where you like it.

Snapshot a server

This script is slightly different (to provide some different examples) it finds the machine in MyCloudSpace via the network guest name which if this is being run internally from a automatic patching system or similar you will want to be able to query the machine on your network and use this as opposed to the MyCloudSpace server name.

You run the script with the following where WIN-LCNQ83SRT2M is guest name for this server but is likely to be something like server.yourlan.local on your side.

.\TakeSnapshotOfVirtualMachine.ps1 -vmHostname "WIN-LCNQ83SRT2M" -snapshotName "This is from the API"
Take a snapshot example

You can then see the snapshot is active in MyCloudSpace. You could also remove this snapshot via the api if you wanted too but adjusting the script slightly.


If you want to just run your own commands against the API you can. You just need to set the following two headers.

  • Authorization: apiKey {yourapikeygoeshere}
  • x-mcs-user: {}

I am working on getting some more examples out there and expanding the developer documentation but there is a swagger for the API.

If you are making something or have a problem you are trying to tackled then get in touch I am more than happy to work with you to get it up and running!

Ben Young

Ben is the Development Manager at vBridge and the gate keeper of MyCloudSpace.