• Walter Kogler (Customer)

    Hi Mike,

    I would create an attribute for the devices.

    Example

    Warranty expiration = 6/6/2024

     

  • Mike Rockwell (Progress Software)

    Ok. Here's what you need to do

    Open PowerShell on the WUG server as an Administrator (Run as Admin)

    Run this command "Install-Module -Name WhatsUpGoldPS " This will install this

     

    Then create an Attribute named "Warranty" and the value should be a date in the format of "MM/DD/YYYY" on your devices

    Next create a PowerShell Active monitor with the script below, replacing the "your info goes here" fields with your actual data, userID, password, WUG server IP etc ....

    Then add the monitor to your devices.

     

    1. $DevID = $Context.GetProperty("DeviceID")
    2.  
    3. $userID = "Your UserID"
    4. $pwd = "Your Password"
    5. $wugServer = "Your wug server IP"
    6.  
    7.  
    8. $secpwd = convertto-securestring $pwd -asplaintext -force;
    9. $cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $userID,$secpwd;
    10.  
    11. Connect-WUGServer -serverUri $wugServer -Protocol http -Credential $cred
    12.  
    13. $value = Get-WUGDeviceAttributes -DeviceID $DevID -NameContains Warranty
    14.  
    15. [datetime]$expDate = $value.value
    16.  
    17. $nCode = 0
    18.  
    19. $sErrorMsg = "The expiration date is " + $expDate.ToString("MM/dd/yyy")
    20.  
    21. $today = Get-Date -Format MM/dd/yyyy
    22.  
    23. $nDaysToNotify = 30
    24.  
    25. $dateDiff = (New-TimeSpan -End $expDate -Start $today).Days
    26.  
    27. if ($dateDiff -le $nDaysToNotify) {
    28. $nCode = 1
    29. $sErrorMsg = "The warrenty will expire in ${dateDiff} days"
    30. }
    31.  
    32. $Context.SetResult($nCode, $sErrorMsg)

     

  • Walter Kogler (Customer)

     

    Hi Mike,

    thanks for the idea. I only had to change the date format because the server is German. MM/dd/yyyy to dd/MM/yyyy

    thanks again