Since I was trying to get license details for a Sitecore instance, so thought to share with all.
below are ways to get Sitecore license details using Sitecore PowerShell script as
$licensePath = [Sitecore.Configuration.Settings]::LicenseFile
[xml]$licenseDocument = Get-Content -Path $licensePath
$licenseDocument.signedlicense.Signature.Object.license |Format-Table -AutoSize