none
Setup Alerting for Windows Activation in SCOM 2012R2 RRS feed

  • Question

  • I need to setup alerts for when a Windows Server needs Activation.

    I had a look and can find only a Windows Server 2003 Operating System with Windows Activation State monitor and its Enabled by Default.

    I read in the MP Guide that this should be able to do Win2012R2 as well but I am not getting any alerts.
    Am I missing something here?
    I could not locate any update to the Windows Server Operating System MP, my current version is: 6.0.7323.0 the Library / Reports 10.0.80.

    Do I need to Enable /Disable something?


    Saiyad Rahim

    Tuesday, July 7, 2020 10:30 PM

All replies

  • Hi,

    Only the Windows Server 2003 operating system management pack had a monitor for the Windows activation state, newer Windows Server operating system management packs don't have this monitor, because these events are not generated on newer Windows Server operating systems.

    Basically the Windows Activation State monitor is checking the Application event log for event ID 1005 (Windows is not activated), and event ID 1006 (Windows is activated).

    I believe in newer Windows Server operating systems the events are different, so the ones used in the Windows Server 2003 management pack are not applicable for newer Windows Server operating systems.

    You'll need to do some research to find out which events are generated if a Windows Server 2008 and newer generate if they are not activated, then you can either create a custom management pack or custom monitor to monitor these events.

    Here's Cameron's blog post on how he created a custom management pack to check the licensing of Windows Server 2008 servers:
    https://www.catapultsystems.com/blogs/windows-server-2008-product-activation-amp-operations-manager

    Best regards,
    Leon


    Blog: https://thesystemcenterblog.com LinkedIn:


    • Edited by Leon Laude Tuesday, July 7, 2020 11:53 PM
    Tuesday, July 7, 2020 11:52 PM
  • Thanks Leon.

    I came across this info, do you think this works (I am setting up a test server to test):

    The monitor in the current Windows OS MP, such as Windows Server 2012 Operating System (Monitoring)

    , is called Reserved, and it is disabled by default.

     

    Description of the monitor “Reserved”:

    Microsoft Corporation developed Product Activation for Microsoft® Windows® operating systems to help ensure that each Windows operating system license is installed in compliance with the End User License Agreement (EULA), and that it is not installed on more than the limited number of computers (usually one) allowed by the product EULA. Please note, however, that volume licensed versions of Microsoft® Windows Server™ 8 operating systems do not require activation.

    Causes

    An alert is generated by this rule when Windows has not been activated and the activation threshold is reached. The threshold for this rule is when product activation must occur when 5 days or less.


    Saiyad Rahim

    Wednesday, July 8, 2020 7:21 AM
  • Hello,

    I did that with use of PowerShell Monitor, it works on Windows Severs 2008+ 

    #Load the MOMScript API and the PropertBag provider
    $api = New-Object -comObject "MOM.ScriptAPI"
    $PropertyBag = $api.CreatePropertyBag()
    $ScriptName = "ActivationWindowsCheck.ps1"
    $EventID = "123"
    $StartTime = Get-Date
    $whoami = whoami
    $hostname = [System.Net.DNS]::GetHostByName('').HostName

    $API.LogScriptEvent($ScriptName,$EventID,0,"Script is starting. Running as ($whoami)") 

    #Main script
    $license = Get-WmiObject -query "SELECT * FROM SoftwareLicensingProduct WHERE Name like '%Windows%' AND LicenseStatus != '1'" | Where-Object {$_.PartialProductKey} | select name, description, LicenseStatus 

        if($license.count -eq '0' -or !$license)
        {$status ='Licensed'}
        else
        {
        $o=@()
        foreach($li in $license){$o=$li.description+', '+$o}
        $status='Unlicensed'
        #Add the data into the PropertyBag
        $PropertyBag.AddValue("Licenses",$o)
        }

    #Add the data into the PropertyBag
    $PropertyBag.AddValue("Status",$Status)
    $PropertyBag.AddValue("Server",$hostname)

    $EndTime = Get-Date
    $ScriptTime = ($EndTime - $StartTime).TotalSeconds

    #Log an event that our script is complete
    $api.LogScriptEvent($ScriptName,$EventID,0,"Check if Windows is Activated, Status:$Status. Script Runtime: ($ScriptTime) seconds")
    $PropertyBag  


    Wednesday, July 8, 2020 7:48 AM
  • ok so I have a Test 2012R2 Server.

    I have ran slmgr /dlv and slmgr /upk "Activation ID" to deactivate the Windows License.

    Waited in SCOM and nothing.

    Check the Application and System Logs and could not find any specific Event ID for License Not Activated.

    Maybe I will have to wait for sometime before and event is finally logged.


    Saiyad Rahim

    Wednesday, July 8, 2020 8:00 AM
  • I don't think the "Reserved" monitor will work, as I said the events have changed in newer Windows Server operating system versions.

    You can try and implement Furselek's solution which appears correct, WMI is probably the best way of checking this.

    Monitor activation
    https://docs.microsoft.com/en-us/windows/deployment/volume-activation/monitor-activation-client

    Run the following script manually to check the status of the $License variable:

    $license = Get-WmiObject -query "SELECT * FROM SoftwareLicensingProduct WHERE Name like '%Windows%'" | Where-Object {$_.PartialProductKey} | select name, description, LicenseStatus 
    Then run Slmgr and check what the "LicenseStatus" is, see if the "LicenseStatus" is not = 1.


    Blog: https://thesystemcenterblog.com LinkedIn:

    Wednesday, July 8, 2020 8:21 AM
  • Hi,

    Found a document which seemed helpful for our question, please refer to the link below.

    Detecting Windows License Activation Status Using ConfigMgr DCM and OpsMgr

    $InstalledLicense = Get-WmiObject -Query "Select * from SoftwareLicensingProduct Where PartialProductKey IS NOT NULL AND ApplicationID = '55c92734-d682-4d71-983e-d6ec3f16059f'"
    Switch ($InstalledLicense.LicenseStatus)
    {
    0 {"Unlicensed"}
    1 {"Licensed"}
    2 {"Out-of-Box Grace Period"}
    3 {"Out-of-Tolerance Grace Period"}
    4 {"Non-Genuine Grace Period"}
    5 {"Notification"}
    6 {"ExtendedGrace"}
    }


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Wednesday, July 8, 2020 9:13 AM
    Moderator
  • This looks simple enough.

    Have some questions:

    I tested the script manually to check the status of the $License variable on a test server that had DataCenter License and I did not get a value back. does this not work on all License type?

    How do I use this in SCOM Console, do i use a UNIT monitor and use script based monitor?

    How does this actually work in SCOM? Does it show up in the console as an Alert or Information, if not then how do we get it to do that?

    How do I set up notifications on this?

    But most importantly, I find it bewildering that a Microsoft Monitoring Tool does not have the capability to detect Windows License Status.


    Saiyad Rahim

    Thursday, July 9, 2020 7:05 AM
  • There are many ways of checking the license status with either command-line or PowerShell, you can use any method that suits your needs.

    Then simply create a two-state unit monitor which runs a PowerShell script that checks the license status on the monitored agents.

    You can use CookDown's PowerShell authoring for this which makes life easier:
    https://cookdown.com/scom-essentials/powershell-authoring/

    There's a webinar on how to create a monitor which uses a PowerShell script:
    https://www.youtube.com/watch?v=--wOzKU52JE

    If you have any feedback about not being able to detect the Windows License Status, please submit the feedback over here:
    https://systemcenterom.uservoice.com/forums/293064-general-operations-manager-feedback


    Blog: https://thesystemcenterblog.com LinkedIn:


    • Edited by Leon Laude Thursday, July 9, 2020 8:54 AM
    Thursday, July 9, 2020 8:53 AM