Hi
Recently had a change to play a bit with the Veeam API in a Veeam Cloud Connect setup. I was quite a pleasure as the API is publicly well documented and over all well maintained. Had a single issue when I tried to install the Veeam Powershell snapin as it is created for Powershell version 2, and Powershell version 4 is the newest. Would be nice if that would get updated. I just jump over to another server which I knew had the snapin installed and started working on the script. The script is pretty basic, but does just what is needed. It calls the cmdlet Get-VBRCloudTenant. Which is all that is needed to get the data needed. I then does some simple math on two of the outputs and put it all in a new variable called $Reports.
When all data is collected, processed and stored in the variable $Reports, it is being send out via email to those who needs it. I will not cover how to send the email, as it should be pretty clear. A thing to note is line 19 in the script. After converting the data in $Reports, I pipe the data over to out-string. If not it will come out as all useless data. So worth doing.
The last line of the script is the one which is actually sending the email out. Note the -BodyAsHtml, which insures that the data is embedded into the email, making the email fast and easy to read.
The outcome from the $reports variable as seen below.
Name | VMCount | QuotaGB | UsedGB | Used% |
Client 1 | 139 | 45000 | 42372 | 94.2 |
Client 2 | 3828 | 300000 | 274389 | 91.5 |
Client 3 | 92 | 1000 | 392 | 39.2 |
If you do not like the way it looks when the table is converted to html. You are able to modify it. The are some simple ways in which you can add color and style to the table. You can read all about it on Microsoft’s Technet here.
I hope this can help some one else. Which is in need to report on data from a Veeam software suite.