Jump to content

JordanT

Members
  • Posts

    7
  • Joined

  • Last visited

Posts posted by JordanT

  1. tldr: I have an endpoint policy to trigger a workflow from an event log I have it set to notify on low, is there a way to have the low notification auto deleted as the workflow that triggers sends an elevated alert for workstations with 5 or more days uptime 
    Capture.thumb.PNG.7b569b394aca7359dc39bf72b2111dae.PNG
    2.thumb.PNG.73b4863b4a6f65fb8f5cbbd1417f2443.PNG

  2. 7 minutes ago, Mark G38 said:

    I am not a Pusleway user anymore, but there are a couple of ways you could do this.  You mention event ID, but I don't see any logic in your script to write an event ID to the event log.

    However, that would probably be the easiest way, and then have Pulseway look for (and alert off of) that event entry.  I always set up a custom Event Log and then use my own codes so that I never have to worry about looking through logs with other stuff in it.  All my stuff goes to a custom log I set up.  

    As far as your code, your logic seems, a bit off to me unless I'm just too tired lol, but your first if statement, your essentially saying if lastboot is BEFORE 14 days ago, SetCustomeFieldNo... Would you want that to be a yes, since that means it hasn't rebooted in over 14 days? I think your statements are backwards.  I assume your SetCustomField Yes would be used for if it's been up for over 14 days. Maybe I'm just reading it wrong.

    I personally wouldn't bother with setting the custom fields. I would again, just write to whatever event log you want, with whatever event ID you want, set Pulseway to alert off that event ID, and then schedule your script to run once a day.  As soon as it runs and sees a machine over 14 days, it creates event log entry which Pulseway will then alert you to. 

    Yeah I think I am trying to make it too complicated and I'm 99% sure you're correct about the customfields being the wrong way because, I am using a workflow to add a tag and all my computers just about put themselves into "Uptime" tag i made

  3. At the moment I'm trying to get a script to register on event id 4624 to check if the computer has been online for 14 days or more and this isn't working sadly if i could get any tips or improvements


     

    # Outputs
    $SETCUSTOMFIELDNO = "SHORT"
    $SETCUSTOMFIELDYES = "LONG"
    $days = 14
    $system = Get-WmiObject win32_operatingsystem
    
    if($system.ConvertToDateTime($system.LastBootUpTime) -lt (Get-Date).AddDays(-$days)){
        Start-Process -FilePath "$env:PWY_HOME\CLI.exe" -ArgumentList ("setVariable SETCUSTOMFIELDNO ""$SETCUSTOMFIELDNO""") -Wait
    
    }else{
        Start-Process -FilePath "$env:PWY_HOME\CLI.exe" -ArgumentList ("setVariable SETCUSTOMFIELDYES ""$SETCUSTOMFIELDYES""") -Wait
    
    
    }

     

  4. On 6/4/2022 at 4:12 AM, Mark G38 said:

    I wrote and used this often (before using a 3PP solution).  The only thing is I couldn't find a static link to Adobe Reader DC when I wrote this, so I simply downloaded the latest version, and hosted it in AWS S3 and pulled it from there.  So feel free to find a static URL or do the same I did.  

    Function New-FileDownload {
        param(
            [Parameter(Mandatory = $true)]
            [ValidateNotNullOrEmpty()]
            [string]$Url,
            [Parameter(Mandatory = $true)]
            [ValidateNotNullOrEmpty()]
            [string]$Destination
        )
        $webClient = New-Object System.Net.WebClient
        $webClient.DownloadFile($Url, $Destination)
        if (Test-Path -LiteralPath $Destination) {
            Write-Verbose "File downloaded Successfully"
            return $true
        }
        else {
            Write-Verbose "File download Failed"
            return $false
        }
    }
     
    $AppName = "Adobe Acrobat Reader DC"
     
    $InstallStatus = Get-ItemProperty "HKLM:\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*" |
    Where-Object { $_.DisplayName -eq $AppName }
    if ($InstallStatus) {
        Write-Output "$($AppName) already installed."
        Exit 0
    }
     
    $AdobeURL = "ENTER YOUR URL TO AdobeReaderDC.exe"
    $Destination = "$($env:temp)\adobeinstall.exe"
    $FileDownload = New-FileDownload -Url $AdobeURL -Destination $Destination
    if ($FileDownload) {
        Write-Output "Download succeeded, beginning Adobe Reader install..."
        Start-Process "$($Destination)" -ArgumentList "/sAll /rs /msi EULA_ACCEPT=YES" -Wait -NoNewWindow
        $InstallStatus = Get-ItemProperty "HKLM:\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*" |
        Where-Object { $_.DisplayName -eq $AppName }
        if ($InstallStatus) {
            Write-Output "$($AppName) successfully installed."
            Exit 0
        }
        else {
            Write-Output "$($AppName) failed to install."
            Exit 1
        }
    }
    else {
        Write-Output "Failed to download installation file. Exiting."
        Exit 1
    }

     

    Thank you this will work perfectly 

  5. Hello,

    Trying to figure out a way to update abode via pulseway most of our computers are win10 and some win11 or is there a plugin that will work if a script isn't possible ? 

    Is there also an automated script to return all the accounts that haven't logged in for X amount of days then delete those user accounts without having to do "Connect-AzureAD" as I don't want to put Azure creds online 

    Regards, Jordan

×
×
  • Create New...