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

License information

Post by b.vanhaastrecht » Oct 14, 2015 7:50 am

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 and Cloud Connect Provider

veremin
Product Manager
Posts: 17075
Liked: 1475 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: License information

Post by veremin » 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.

PTide
Product Manager
Posts: 5349
Liked: 471 times
Joined: May 19, 2015 1:46 pm
Contact:

Re: License information

Post by PTide » Oct 14, 2015 9:33 am 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: 564
Liked: 98 times
Joined: Aug 26, 2013 7:46 am
Full Name: Bastiaan van Haastrecht
Location: The Netherlands
Contact:

Re: License information

Post by b.vanhaastrecht » Oct 14, 2015 9:38 am

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 and Cloud Connect Provider

veremin
Product Manager
Posts: 17075
Liked: 1475 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: License information

Post by veremin » Oct 14, 2015 10:04 am

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 » Mar 22, 2016 12:02 pm

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: 17075
Liked: 1475 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: License information

Post by veremin » Mar 22, 2016 12:29 pm

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 » Mar 22, 2016 1:53 pm

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: 17075
Liked: 1475 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: License information

Post by veremin » Mar 23, 2016 12:03 pm

Glad to hear my input was helpful. The updated script looks good, thanks for sharing!

onthax
Service Provider
Posts: 33
Liked: 1 time
Joined: May 13, 2013 2:32 am
Location: Brisbane
Contact:

[MERGED]: Reporting on license count

Post by onthax » May 11, 2016 1:45 am

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: 5349
Liked: 471 times
Joined: May 19, 2015 1:46 pm
Contact:

Re: License information

Post by PTide » May 11, 2016 10:05 am

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 » Oct 04, 2016 10:47 am 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: 103
Liked: 18 times
Joined: Mar 16, 2015 4:00 pm
Full Name: David Rubin
Contact:

Re: License information

Post by RubinCompServ » Feb 06, 2018 5:53 pm

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: 17075
Liked: 1475 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: License information

Post by veremin » Feb 07, 2018 12:40 pm

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: 103
Liked: 18 times
Joined: Mar 16, 2015 4:00 pm
Full Name: David Rubin
Contact:

Re: License information

Post by RubinCompServ » Feb 28, 2018 3:38 pm

A combination of Rental and Cloud Connect.

onthax
Service Provider
Posts: 33
Liked: 1 time
Joined: May 13, 2013 2:32 am
Location: Brisbane
Contact:

Re: License information

Post by onthax » Mar 06, 2019 11:24 pm

+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: 103
Liked: 18 times
Joined: Mar 16, 2015 4:00 pm
Full Name: David Rubin
Contact:

Re: License information

Post by RubinCompServ » Mar 07, 2019 1:13 pm

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: 17075
Liked: 1475 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: License information

Post by veremin » Mar 07, 2019 2:23 pm

We do plan to make this information available in PowerShell in one of the next product releases. Thanks!

riahc3
Enthusiast
Posts: 81
Liked: 4 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 » Mar 16, 2019 6:20 pm

Hello

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

How can I do this?

DGrinev
Veeam Software
Posts: 1819
Liked: 230 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 » Mar 18, 2019 11:42 am

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
Enthusiast
Posts: 81
Liked: 4 times
Joined: Oct 21, 2015 10:01 am
Full Name: John
Contact:

Re: License information

Post by riahc3 » Apr 04, 2019 9:13 pm

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


Even a SQL query would be fine.

riahc3
Enthusiast
Posts: 81
Liked: 4 times
Joined: Oct 21, 2015 10:01 am
Full Name: John
Contact:

Re: License information

Post by riahc3 » Apr 07, 2019 1:10 pm

Nothing at all?

DGrinev
Veeam Software
Posts: 1819
Liked: 230 times
Joined: Dec 01, 2016 3:49 pm
Full Name: Dmitry Grinev
Location: St.Petersburg
Contact:

Re: License information

Post by DGrinev » 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!

veremin
Product Manager
Posts: 17075
Liked: 1475 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: License information

Post by veremin » 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!

riahc3
Enthusiast
Posts: 81
Liked: 4 times
Joined: Oct 21, 2015 10:01 am
Full Name: John
Contact:

Re: License information

Post by riahc3 » Apr 14, 2019 4:42 pm

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
Enthusiast
Posts: 81
Liked: 4 times
Joined: Oct 21, 2015 10:01 am
Full Name: John
Contact:

Re: License information

Post by riahc3 » Apr 14, 2019 4:44 pm

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: 17075
Liked: 1475 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: License information

Post by veremin » Apr 15, 2019 6:18 pm

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

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 5 guests