#Setting the environment $env:NINJARMMCLI = "C:\ProgramData\NinjaRMMAgent\ninjarmm-cli.exe" #Setting variables $softwareName = "*Coro" $uninstallPath32 = "HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*" $registryResult32 = Get-ItemProperty -Path $uninstallPath32 | Where-Object { $_.DisplayName -like $softwareName } $uninstallPath64 = "HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*" $registryResult64 = Get-ItemProperty -Path $uninstallPath64 | Where-Object { $_.DisplayName -like $softwareName } $valueReg64 = $registryResult64.UninstallString $match = [regex]::Match($valueReg64, '\{[^}]+\}') if ($match.Success) { $uninstallStringReg64 = $match.Value } else { } try { $packageResult = Get-Package | Where-Object { $_.Name -like $softwareName } } catch { } try { $wmiResult = Get-WmiObject -Class Win32_Product | Where-Object { $_.Name -like $softwareName } if ($wmiResult -ne $null) { $wmiIdentifyingNumber = $wmiResult.IdentifyingNumber $wmiValue = $true } else { } } catch { } #Check if Coro is installed function Check-Installed { $installed = $false if ($registryResult32 -or $registryResult64 -or $packageResult -or $wmiResult) { $installed = $true & $env:NINJARMMCLI set coroInstalled 1 } elseif (Test-Path "C:\Program Files\Coro Cyber Security Ltd\Coro\user\Coro.exe") { $installed = $true & $env:NINJARMMCLI set coroInstalled 1 } else { & $env:NINJARMMCLI set coroInstalled 0 $installed = $false } return $installed } $installed = Check-Installed #Check if Coro is running if ($installed -eq "true") { $logFile = "C:\ProgramData\CoroAgent1SRV\p\status\antivirus.json" $json = Get-Content $logFile if($json -match '"running":(true|false)') { $runningStatus = $Matches[1] if($runningStatus -eq "true") { & $env:NINJARMMCLI set coroRunning 1 } else { & $env:NINJARMMCLI set coroRunning 0 } } } else { & $env:NINJARMMCLI set coroRunning 0 } #Check update status if ($installed -eq "true") { $logFileNew = "C:\ProgramData\CoroAgent1SRV\p\status\antivirus.json" $fileContent = Get-Content $logFileNew if($fileContent -match '"upToDate":(true|false)') { $runningStatusNew = $Matches[1] if($runningStatusNew -eq "true") { & $env:NINJARMMCLI set coroUpToDate 1 } else { & $env:NINJARMMCLI set coroUpToDate 0 } } } else { & $env:NINJARMMCLI set coroUpToDate 0 } #Check last update time $filePath = "C:\ProgramData\CoroAgent1SRV\p\status\malware_db_update_time.log" if (($installed -eq "true") -and (Test-Path $filePath)) { $timestamp = Get-Content $filePath $date = [DateTimeOffset]::FromUnixTimeSeconds($timestamp) $formattedDate = $date.ToString("dd/MM/yyyy") & $env:NINJARMMCLI set lastUpdateTime $formattedDate } elseif ($installed -ne "true") { & $env:NINJARMMCLI set lastUpdateTime N/A } else { & $env:NINJARMMCLI set lastUpdateTime Will be shown once virus definition files update } #Check Coro version number if ($installed -eq "true") { $registryPath = "HKLM:\SOFTWARE\Coro Cyber Security Ltd\Coro" $valueName = "Version" $value = Get-ItemProperty -Path $registryPath -Name $valueName | Select-Object -ExpandProperty $valueName & $env:NINJARMMCLI set coroVersionNumber $value } else { & $env:NINJARMMCLI set coroVersionNumber N/A }