PowerShell script exchange
Post Reply
Matt.SmartTech
Service Provider
Posts: 18
Liked: 4 times
Joined: Jun 11, 2018 10:50 am
Full Name: Matt
Contact:

Cloud Tenant License type via Powershell (STD\ENT\ENT+)

Post by Matt.SmartTech »

Hello Community.

Hope all are well and somebody is feeling fresh enough to offer any advice.

I am by no means a scripter but I am working on building two scripts to grab month-end reporting data for VCSP & VBO365 (later). Where I am struggling is to get the Licensed Edition of the Tenant (Standard, Enterprise, Enterprise+) etc. I can find this via Swagger in the API but the script I am working on is PS. (If anybody may be interested to guide me on learning material of where to start wrt accessing and exporting API data, that is something I am quite keen on learning too).

At this point I have this:

Code: Select all

//Creds to be replaced by XML method//
$vbrserver = "localhost"
$vbruser = "REMOVED"
$vbrpwd = "REMOVED"

asnp "VeeamPSSnapIn" -ErrorAction SilentlyContinue

Connect-VBRServer -Server $vbrserver -User $vbruser -Password $vbrpwd

$csvFileName = "MC_vcc_report.csv"
$tenantlist = Get-VBRCloudTenant
$quotalist = Get-VBRCloudTenant | select name , {$_.Resources.usedspace},{$_.Resources.repositoryQUota}
$results = @()

foreach ($tenant in $tenantlist) {
        $details = [ordered]@{           
                Tenant           = $tenant
                VM_Licenses        = $Tenant.RentalVMBackupCount
                Wks_Licenses       = $tenant.RentalWorkstationBackupCount
                Srv_Licenses       = $tenant.RentalServerBackupCount
                New_VM_Licenses    = $tenant.NewVMBackupCount
		New_Wks_Licenses   = $tenant.NewWorkstationBackupCount
		New_Srv_Licenses   = $tenant.NewServerBackupCount
		Quota_Used_MB	   = $tenant.Resources.usedspace
		Quota_Allocated_MB = $tenant.Resources.repositoryQuota
        }                          
        $results += New-Object PSObject -Property $details
    }

$results | export-csv -Path $csvFileName -NoTypeInformation

Disconnect-VBRServer
It Gives me this: (unsure if this is going to auto-pull through to the forum as an image)
https://www.dropbox.com/s/2y51b7eobq7fd ... e.PNG?dl=0

The 2 things I'd like to add to this are:
1. Get the License Edition and add it between Tenant & VM_Licenses
2. Automatically calculate the MB under repo's to GB's

Really hoping for some input from the Forum.

Thanks for reading.
Mildur
Product Manager
Posts: 9846
Liked: 2607 times
Joined: May 13, 2017 4:51 pm
Full Name: Fabian K.
Location: Switzerland
Contact:

Re: Cloud Tenant License type via Powershell (STD\ENT\ENT+)

Post by Mildur »

Hi Matt

Are you using the Veeam Service Provider Console? It's REST API has all the information you want to know.
And VB365 metrics (storage, license usage) per client will be supported starting in our next version (V7).
You can also use PowerShell to query RestAPI endpoints.

A few examples:
https://helpcenter.veeam.com/docs/vac/r ... gatedUsage
https://helpcenter.veeam.com/docs/vac/r ... ingReports

If you want to start learning RestAPI, I can recommend you this whitepaper:
https://www.veeam.com/wp-getting-started-rest-api.html

Thanks
Fabian
Product Management Analyst @ Veeam Software
Matt.SmartTech
Service Provider
Posts: 18
Liked: 4 times
Joined: Jun 11, 2018 10:50 am
Full Name: Matt
Contact:

Re: Cloud Tenant License type via Powershell (STD\ENT\ENT+)

Post by Matt.SmartTech »

Hello Mildur

Nice to hear from you.

Yes I am running this on the powershell opened from the VSPC (CC-VBR Server) itself.

Thank you, I will look into those links to try get this via API within Powershell - thats going to be interesting for me :)
V7 with further support for VBO365 sounds great, will be excited to get that rolling when ready.

And thanks again for the 'getting-started' link I will see where I get.

If anybody could perhaps add on here if its possible to get the above License Type data per Tenant via PS straight that would be ideal and much quicker than me learning at this point just to get this report out the door.

Thank you all.
Mildur
Product Manager
Posts: 9846
Liked: 2607 times
Joined: May 13, 2017 4:51 pm
Full Name: Fabian K.
Location: Switzerland
Contact:

Re: Cloud Tenant License type via Powershell (STD\ENT\ENT+)

Post by Mildur »

You're welcome :)
Your approach is using the VBR cloud connect powershell. The service provider console doesn't have a PowerShell module.
If anybody could perhaps add on here if its possible to get the above License Type data per Tenant via PS straight that would be ideal and much quicker than me learning at this point just to get this report out the door.
As far as I know this information is not provided within the Veeam cloud connect backup server. The management agent from the service provider console collects this information and stores it in the service provider console configuration database. RestAPI should be used.
There is an example on how to use the REST API with Powershell. You can use it as a template for the API calls:
https://github.com/VeeamHub/powershell/ ... rageReport


Thanks
Fabian
Product Management Analyst @ Veeam Software
BackupBytesTim
Service Provider
Posts: 442
Liked: 80 times
Joined: Apr 29, 2022 2:41 pm
Full Name: Tim
Contact:

Re: Cloud Tenant License type via Powershell (STD\ENT\ENT+)

Post by BackupBytesTim »

Semi-unrelated question, but the search got me here and it seems the most relevant thread I could find.
The service provider console doesn't have a PowerShell module.
Does this mean the Cloud Connect VBR Server does not work with the PowerShell module?

When I use Connect-VBRServer to connect to a CC VBR Server it seems to connect fine, but then Get-VBRJob returns nothing.
Mildur
Product Manager
Posts: 9846
Liked: 2607 times
Joined: May 13, 2017 4:51 pm
Full Name: Fabian K.
Location: Switzerland
Contact:

Re: Cloud Tenant License type via Powershell (STD\ENT\ENT+)

Post by Mildur » 1 person likes this post

Veeam Cloud Connect and Service Provider Console are different products.

Veeam Cloud Connect is a Veeam Backup & Replication server and you can use PowerShell.

Veeam Service Provider Console is a web application and only provides REST API.

Best,
Fabian
Product Management Analyst @ Veeam Software
BackupBytesTim
Service Provider
Posts: 442
Liked: 80 times
Joined: Apr 29, 2022 2:41 pm
Full Name: Tim
Contact:

Re: Cloud Tenant License type via Powershell (STD\ENT\ENT+)

Post by BackupBytesTim »

Okay, that's what I thought before I read that. I misunderstood, assumed you were talking about the VBR Console when used with a Cloud Connect VBR server.

Thanks for the clarification.
Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests