This has probably been discussed but I can't seem to find it. Is there a way to poll for license information? I have a lot of MS servers and it would be nice to know what license is attached to what server. Is this possible?
wdecatur wrote:This has probably been discussed but I can't seem to find it. Is there a way to poll for license information? I have a lot of MS servers and it would be nice to know what license is attached to what server. Is this possible?
wdecatur wrote:
There are definitely ways to access license information using SAM. For instance if you wanted to know about your office 365 licenses, you'd be able to modify the existing application templates that utilize Microsoft Graph (see: Integrate Office 365 templates with Microsoft Graph ) to access their licensing apis for more information and pull that into your SAM installation.
See: List licenseDetails - Microsoft Graph v1.0 | Microsoft Docs
Hmm, how about win10? I'm not familiar with running this Microsoft Graph
wdecatur wrote:Hmm, how about win10? I'm not familiar with running this Microsoft Graph
Another way that could work is utilizing these WMI classes that provide licensing information Software License Provider | Microsoft Docs
You could grab that information via a powershell script monitor or WMI monitor. Doing a quick google, there was one example of a person utilizing powershell to grab the licensing info from the WMI object.
This looks promising. So I can pull it via powershell but how do I get that information out of powershell and into orion in a manner that I can view it from asset details?
This took me awhile to get back around to this as I got pulled into another project. So here is where I am
I created a new PS script
$lic = powershell "(Get-WmiObject -query ‘select * from SoftwareLicensingService’).OA3xOriginalProductKey";
Write-Host "Statistic:$lic"
I works well in powershell but SolarWinds doesn't seem to know what to do with it as I keep getting this errorTesting on node ITTestSystem: Failed with "unknown" status.Output: =====================================================Statistic:12345-12345-12345-12345-12345On the node side of things I get PowerShell script error. Scripting Error: Script does not contain the expected parameters or is improperly formatted. 'Statistic' missing.
What am I missing?
Pretty sure the statistic has to be a number without the dashes. Maybe you can change your last part to below
Write-Host "Statistic: 1"
Write-Host "Message: $lic"
Exit 0
NICE!!!! Now, how do I extract this info and place in a custom field so I can search?
you could create a report that looks at that specific component name (i would name it something specific) and then pass the message field into the report.
If you wanted to make it automated you would have to create a powershell script that brings those values in and then updates a custom property you have created below is link for how to get started using the OrionSDK
GitHub - solarwinds/OrionSDK: SDK for the SolarWinds Orion platform, including tools, documentation, and samples in Powe…
****EDIT 1****
Something like below might get the trick done.
It assumes the Custom Property you want to update is a Nodes Custom Property named "ProductKey" and that the name of the component running the PowerShell to pull the value in is called "License Key"
$swis = Connect-Swis -UserName $username -Password $password -Hostname $hostname#Get list of Nodes and Custom Property$nodes = @(Get-SwisData $swis “SELECT distinct n.CustomProperties.Uri, ac.ErrorMessage, n.captionFROM Orion.APM.CurrentStatistics acjoin orion.apm.Application a on ac.ApplicationID = a.ApplicationIDjoin orion.Nodes n on a.NodeID = n.NodeIDwhere ac.ComponentName = 'License Key'“)foreach ($node in $nodes) {$Update = @{ProductKey = $node.errormessage;}Write-Output "Setting the ProductKey Custom Property"Set-SwisObject $swis -URI $node.uri -Properties $update;}
You'd need to also create the following variables
$username
$password
$hostname
the biggest changes might be if you've named stuff a little differently below is where in the script you'd make that change
Where ac.componentName = 'your componentName'
$update = @{ Your CP Value = $node.errormessage}
Wow! Sorry I've been a bit distant, I got pulled into a DPM project. I'm working my way around to this. This is going to take me a bit to understand as working with PowerShell within Orion is ....... new to me. That script looks easy enough if I'm running it from my local system but I'm guessing I need to configure that within Orion and that's where my learning curve will be. I'll swing back to this in the next week or so when I'm able to go live on DPM
If that's the method you want to use, then you could just create this as a scheduled task to run once a day or something to update those values. There's a mechanism for it to use the credentials that are running the task "Trusted" (that way you don't have to have creds in the script) here's a reference to it PowerShell · solarwinds/OrionSDK Wiki · GitHub essentially you would just change the first line of the script to below and then identify in the scheduled task an account that has the appropriate permissions in SolarWinds to update custom properties
$swis = Connect-Swis -Hostname $hostname -trusted