PowerShell script exchange
Post Reply
b.vanhaastrecht
Service Provider
Posts: 880
Liked: 163 times
Joined: Aug 26, 2013 7:46 am
Full Name: Bastiaan van Haastrecht
Location: The Netherlands
Contact:

License information

Post by b.vanhaastrecht »

Hello,

I would like to fetch the license information from the Enterprise Portal thru Powershell or the RestAPI. But I'm unable to find an CMDlet or schema providing this information. Is that correct?

I'm primairly interested in the support expiry date. What are my options to get it thru scripting?

Kind Regards,
Bastiaan
======================================================
Veeam ProPartner, Service Provider and a proud Veeam Legend
veremin
Product Manager
Posts: 20389
Liked: 2298 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: License information

Post by veremin »

As far as I know, information regarding license is not present in PowerShell, neither is it in RESTful API. The only way I can think of is to query db directly. Thanks.
PTide
Product Manager
Posts: 6551
Liked: 765 times
Joined: May 19, 2015 1:46 pm
Contact:

Re: License information

Post by PTide » 1 person likes this post

Hi,

Please try this:

Code: Select all

$regBinary = (Get-Item 'HKLM:\SOFTWARE\VeeaM\Veeam Backup and Replication\license').GetValue('Lic1')
$veeamLicInfo = [string]::Join($null, ($regBinary | % { [char][int]$_; }))
Kudos to this guy
b.vanhaastrecht
Service Provider
Posts: 880
Liked: 163 times
Joined: Aug 26, 2013 7:46 am
Full Name: Bastiaan van Haastrecht
Location: The Netherlands
Contact:

Re: License information

Post by b.vanhaastrecht »

Getting it thru the registry works, thanks! (had to adjuist the verison checking, but it works)

Would prefer something Veeam supported like RestAPI or PowerShell CMDlet, so I do not have to worry about this custom script to get incompliant with upcoming Veeam version upgrade.

So a feature request to fetch license information thru RestAPI or PowerShell please.
======================================================
Veeam ProPartner, Service Provider and a proud Veeam Legend
veremin
Product Manager
Posts: 20389
Liked: 2298 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: License information

Post by veremin »

Your voice about availability of license information in our automation services has been heard. Thanks for the feedback; appreciated.
tom.adams
Service Provider
Posts: 8
Liked: never
Joined: Nov 24, 2015 3:10 pm
Full Name: Thomas Adams
Contact:

[MERGED]:Get Cloud Connect Backup/Replica Usage Programmatic

Post by tom.adams »

Hello,

Under the License Information window in the Veeam Gui, does anyone know how to obtain these two values?

Cloud Connect (Backup)
Cloud Connect (Replica)

I could do with accessing the information via powershell, c# or the rest api as we are importing the information into another application. Just to clarify, i'm not looking for the information stored in the license, i'm looking to obtain the "Used" amount.

Any help is appreciated. Cheers
veremin
Product Manager
Posts: 20389
Liked: 2298 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: License information

Post by veremin »

General information:

Code: Select all

$BackupCount = 0
$ReplicaCount = 0 
foreach ($Tenant in Get-VBRCloudTenant)
{
    $BackupCount = $BackupCount + $Tenant.VMCount
    $ReplicaCount = $ReplicaCount + $Tenant.ReplicaCount
}
$BackupCount, $ReplicaCount
Information per tenant:

Code: Select all

Get-VBRCloudTenant | select -Property @{N="Tenant";E={$_.name}}, @{N="Backup Count";E={$_.VMCount}}, @{N="Replica Count";E={$_.ReplicaCount}} | ft   
Thanks.
tom.adams
Service Provider
Posts: 8
Liked: never
Joined: Nov 24, 2015 3:10 pm
Full Name: Thomas Adams
Contact:

Re: License information

Post by tom.adams »

Thanks Vladimir,

I had to update the script you provided slightly as we have some cloud tenants that are disabled or they have an expiration date which has now expired.
Here is the updated script just in case someone needs the same information

Code: Select all

$BackupCount = 0
$ReplicaCount = 0 

Get-VBRCloudTenant | Where-Object {($_.Enabled -eq $TRUE) -and (($_.LeaseExpirationEnabled -eq $FALSE) -or (($_.LeaseExpirationEnabled -eq $TRUE) -and ($_.LeaseExpirationDate -gt (Get-Date))))} | ForEach-Object {
$BackupCount = $BackupCount + $_.VMCount
$ReplicaCount = $ReplicaCount + $_.ReplicaCount
}

$BackupCount, $ReplicaCount
Before it was slightly off with the values but now it seems to be reporting correctly. Many Thanks!
veremin
Product Manager
Posts: 20389
Liked: 2298 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: License information

Post by veremin »

Glad to hear my input was helpful. The updated script looks good, thanks for sharing!
onthax
Service Provider
Posts: 40
Liked: 1 time
Joined: May 13, 2013 2:32 am
Location: Brisbane
Contact:

[MERGED]: Reporting on license count

Post by onthax »

Hi All,

We are trying to report on our license count, can either do this from powershell or sql to inject it into our monitoring server and get backup license trending.

what we've found recently is that our licensing in veeam is far in excess of what we see from our SQL query and what we expect in the environment. (Over 100 protected VMs higher)

Anyone aware of an SQL query that can be run against the veeam database to return this number
PTide
Product Manager
Posts: 6551
Liked: 765 times
Joined: May 19, 2015 1:46 pm
Contact:

Re: License information

Post by PTide »

Hi Onthax,

Please review the thread and feel free to ask additional questions if any arise.

Thank you.
toxicavenger
Novice
Posts: 3
Liked: 1 time
Joined: Jun 10, 2016 9:03 am
Contact:

[MERGED] Veeam License Monitoring

Post by toxicavenger » 1 person likes this post

Hi,

Is there a way to extract some infomation about the current license in use through powershell. I need informations like number of VMs assigned to our license and how much we got left.
RubinCompServ
Service Provider
Posts: 326
Liked: 78 times
Joined: Mar 16, 2015 4:00 pm
Full Name: David Rubin
Contact:

Re: License information

Post by RubinCompServ »

I've reviewed the thread (and others) and I don't see an answer to this question. I want to generate a list (wither via SQL or PowerShell) of all the VMs that are currently licensed (in other words, the list that appears in the "Licensed VMs" dialog box).
veremin
Product Manager
Posts: 20389
Liked: 2298 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: License information

Post by veremin »

What kind of license are you using? VCSP rental, VCSP Cloud Connect rental, etc.? Depending on the answer, we might propose a way to get the requested information even without scripting. Thanks.
RubinCompServ
Service Provider
Posts: 326
Liked: 78 times
Joined: Mar 16, 2015 4:00 pm
Full Name: David Rubin
Contact:

Re: License information

Post by RubinCompServ »

A combination of Rental and Cloud Connect.
onthax
Service Provider
Posts: 40
Liked: 1 time
Joined: May 13, 2013 2:32 am
Location: Brisbane
Contact:

Re: License information

Post by onthax »

+1 on the feature request for RESTAPI access to licensing information, particularly if you are multi tenant and need to sort them by customer.
RubinCompServ
Service Provider
Posts: 326
Liked: 78 times
Joined: Mar 16, 2015 4:00 pm
Full Name: David Rubin
Contact:

Re: License information

Post by RubinCompServ »

v.Eremin wrote: Oct 14, 2015 9:32 am As far as I know, information regarding license is not present in PowerShell, neither is it in RESTful API. The only way I can think of is to query db directly. Thanks.
I had a great script that would query the database and could extract usage information by customer. Unfortunately, the "LicensedVMs" table went away with 9.5 U4 and Cloud Connect VMs now only count as a fraction of an instance, so I have to start from scratch. I also give a +1 for this feature, since it seems like even VeeamONE can't collate everything together into a single report.
veremin
Product Manager
Posts: 20389
Liked: 2298 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: License information

Post by veremin »

We do plan to make this information available in PowerShell in one of the next product releases. Thanks!
riahc3
Expert
Posts: 110
Liked: 5 times
Joined: Oct 21, 2015 10:01 am
Full Name: John
Contact:

[MERGED] Get remaining days left in a license via Powershell?

Post by riahc3 »

Hello

I want to get the remaining days left in a license on a local system via Powershell.

How can I do this?
DGrinev
Veteran
Posts: 1943
Liked: 247 times
Joined: Dec 01, 2016 3:49 pm
Full Name: Dmitry Grinev
Location: St.Petersburg
Contact:

Re: Get remaining days left in a license via Powershell?

Post by DGrinev »

Hi John,

In the current version of the product you cannot obtain the license information through the Powershell.
Your voice has been counted as a feature request, thank you!
riahc3
Expert
Posts: 110
Liked: 5 times
Joined: Oct 21, 2015 10:01 am
Full Name: John
Contact:

Re: License information

Post by riahc3 »

What way do you recommend getting license information in a text output?


Even a SQL query would be fine.
riahc3
Expert
Posts: 110
Liked: 5 times
Joined: Oct 21, 2015 10:01 am
Full Name: John
Contact:

Re: License information

Post by riahc3 »

Nothing at all?
DGrinev
Veteran
Posts: 1943
Liked: 247 times
Joined: Dec 01, 2016 3:49 pm
Full Name: Dmitry Grinev
Location: St.Petersburg
Contact:

Re: License information

Post by DGrinev »

Hi John,

Can you share the scenario for getting license information in text, maybe we can consider another approach in solving the objective? Thanks!
veremin
Product Manager
Posts: 20389
Liked: 2298 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: License information

Post by veremin »

You can license expiration date, using this script:

Code: Select all

$regBinary = (Get-Item 'HKLM:\SOFTWARE\VeeaM\Veeam Backup and Replication\license').GetValue('Lic1')
$veeamLicInfo = [string]::Join($null, ($regBinary | % { [char][int]$_; }))  
$ExpirationDateFormat = "Expiration date\=\d{1,2}\/\d{1,2}\/\d{1,4}"
$ExpirationDate = [regex]::matches($VeeamLicInfo, $ExpirationDateFormat)[0].Value.Split("=")[1]
$ExpirationDate
Then, you will need to convert $ExpirationDate to DateTime and subtract current date from it. The resulting value (output in days) will be number of days left till license expiration.

Thanks!
riahc3
Expert
Posts: 110
Liked: 5 times
Joined: Oct 21, 2015 10:01 am
Full Name: John
Contact:

Re: License information

Post by riahc3 »

DGrinev wrote: Apr 07, 2019 8:44 pm Hi John,

Can you share the scenario for getting license information in text, maybe we can consider another approach in solving the objective? Thanks!
Monitoring. Getting licence date/time and depending on that, launch a warning email alert and then a critical alert.
riahc3
Expert
Posts: 110
Liked: 5 times
Joined: Oct 21, 2015 10:01 am
Full Name: John
Contact:

Re: License information

Post by riahc3 »

v.eremin wrote: Apr 08, 2019 5:10 pm You can license expiration date, using this script:

Code: Select all

$regBinary = (Get-Item 'HKLM:\SOFTWARE\VeeaM\Veeam Backup and Replication\license').GetValue('Lic1')
$veeamLicInfo = [string]::Join($null, ($regBinary | % { [char][int]$_; }))  
$ExpirationDateFormat = "Expiration date\=\d{1,2}\/\d{1,2}\/\d{1,4}"
$ExpirationDate = [regex]::matches($VeeamLicInfo, $ExpirationDateFormat)[0].Value.Split("=")[1]
$ExpirationDate
Then, you will need to convert $ExpirationDate to DateTime and subtract current date from it. The resulting value (output in days) will be number of days left till license expiration.

Thanks!

I can work with this, thanks.

The output format though

Is it month/day or day/month?
veremin
Product Manager
Posts: 20389
Liked: 2298 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: License information

Post by veremin »

In my lab the output is provided in day/month format. Thanks!
Post Reply

Who is online

Users browsing this forum: No registered users and 16 guests