# We obtain the license information consulting it's registry key.
# Getting registry key information.
$regkey_veeam = (Get-Item 'HKLM:\SOFTWARE\VeeaM\Veeam Backup and Replication\license').GetValue('Lic1')
# Converting registry key into human readable content.
$lic_veeam = [string]::Join($null, ($regkey_veeam | ForEach-Object { [char][int]$_;}))
# Extracting the expiration date using the previously defined $pattern_date.
$expdate_veeam = [regex]::matches($lic_veeam,$pattern_date)[0].Value.Split("=")[1]
# Getting the days until today.
$licdays_veeam = [int](((Get-Date $expdate_veeam) - (Get-Date)).TotalDays.toString().split(",")[0])
Is there something I can change in this code to get the date I want ?
As per VEEAM console my license will expire in 118 days but when I executed below code output is 264 days. On my VEEAM server short and long date formats are M/d/yyyy and dddd, MMMM d, yyyy respectively.
It should have nothing to do with date formats distinctions since on the step below both date values are being presented in the same format right before subtraction:
So, the code parses the info correctly. That's odd VBR console shows different information.
Just wondering if your VBR console is connecting to the same server you execute the code on.
Yes Oleg, I am executing the code on the VEEAM server and it is connected to localhost.
I will try to execute the code on another VEEAM server and will update.