techNOW Posted November 29, 2023 Share Posted November 29, 2023 Is there any way to do this because i can't figure out a simple way to do it and was wondering if anyone else knew or does this or if im just missing something. Link to comment Share on other sites More sharing options...
Administrators Anne Posted November 30, 2023 Administrators Share Posted November 30, 2023 Hey @techNOW Thanks fro reaching out, you can of course execute this it would just be via a script: <# ============================================================================================================================================ Script Name: Audit: Computers: Uptime In Days Description: Part of the Extended Audit Content Pack for Servers and Computers delivered by Pulseway. Usage: Scheduled to execute in the Task "Extended Audit For Computers - Weekly" tied to the Scope "All Windows 10/11 Computers". Additional notes: This script is write protected and is meant to be used "as is" for Extended Auditing purposes. Vendor: Pulseway Lastest version: 2023-01-27 ============================================================================================================================================ Required variable inputs: None Required variable outputs: Name: "OutputUptimeIndays" Default Type: "Number" Default Value: "0" Associated Custom Field: "Audit: System: Uptime In Days" #> # Please note, this script is write protected and is meant to be used "as is" for Extended Auditing purposes. Function Get-Uptime { $OS = Get-WmiObject win32_operatingsystem $Uptime = (Get-Date) - ($OS.ConvertToDateTime($OS.LastBootUptime)) $Display = + $Uptime.Days Write-Output $Display } $OutputUptimeIndays = Get-Uptime Write-Output "Extended Audit: System: Uptime In Days: $OutputUptimeIndays" # This step writes back the Powershell result to the associated Custom Field. Start-Process -FilePath "$env:RMM_HOME\CLI.exe" -ArgumentList ("setVariable OutputUptimeIndays ""$OutputUptimeIndays""") -Wait You can use just the the Output variable, no Custom Field is required for this to work. Then make a condition based on the output variable being higher than X days in a Workflow. You will need to run it as a script for it to become a Number type variable as currently the Workflow Action "Execute PowerShell Command" only produce Text type variables. So that won't work for the condition. I hope this helps and if you need any more assistance lease let me know Thanks, Stefan Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now