I try to deploy my first own Component Monitor. there I added the Windows Powershell Monitor and this script
$ActivationStatus = Get-CimInstance SoftwareLicensingProduct -Filter "Name like 'Windows%'" | Where-Object { $_.PartialProductKey } | Select-Object LicenseStatus
$LicenseResult = switch($ActivationStatus.LicenseStatus){
0 {"Unlicensed"}
1 {"Licensed"}
2 {"OOBGrace"}
3 {"OOTGrace"}
4 {"NonGenuineGrace"}
5 {"Not Activated"}
6 {"ExtendedGrace"}
default {"unknown"}
}
$LicenseResult
I did not specify any other values.
The goal is to run this script on a node over the (passive) agent, get back the license status and get a warning if its not "Licensed". The script above works find when executed directly on a Win 2919 server.
The reason why I need Orion for that: RPC/WMI is blocked for most VLANs, so I need to find a way around that and want to use Orion for that.
I set a test server, Execution mode to locally and got this error: "Unable to schedule job on agent node 11 - required APM plugin is missing or not installed properly."
I googled that and found that net 4.8 is missing. If I'm not mistaken 4.8 is already installed on Windows server 2019? If not, I only need to install it on the Orion server?
So i changed the Execution Mode to Remote Host. The output is fine, but it tells me "Test failed with unknown status"
"COMPONENT TEST RESULT DETAILS
Output: ==============================================
Licensed"
But for that the Monitor tells me it uses wsman on port 5985, which i fear will be blocked also. Is there no way to run the script locally on the node to test?
So before I go on I would like to ask for help here, if my idea would even work and if I'm on the correct path. Maybe there is a easier solution or it will not ven work, maybe i need parameters ( i dont think so) or specify the output of the script (i dont know how).
I read the manual (Use case: Create a SAM template that uses the Windows PowerShell Monitor to detect possible dictionary attacks (solarwinds.com)), but it forks and forks until I really had no idea anymore.I guess there are examples of powershell monitors and I'm for sure not the only one who wants to get activation/license information from their servers, so I would be grateful if someone can put me in the right direction.
The next /much more complex) script (with several parameters as a result) would gather information about open Windows Updates. The script is already done, but since it also uses WIM/RPC i can't use it and must utilize Orion for it.