Is there a way to monitor the version of Java currently installed on a server? There is a group of Windows servers that host software that requires a certain version of Java to be installed. Java get...
If you set that up in a PropertySource, then you could write a datasource against that property with a datapoint that checks the version string against your required value.
# If the hostname is an IP address query DNS for the FQDN if ($hostname -match "\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b") { $hostname = [System.Net.Dns]::GetHostbyAddress($hostname).HostName }
## This script block should contain all code that you want to execute remotely on the target host. $scriptBlock = {
try { #-----Determin the type of query to make----- # check to see if this is monitoring the localhost collector, as we will not need to authenticate. if ($hostname -like $collectorName) { $response = Invoke-Command -ScriptBlock $scriptBlock } # are wmi user/pass set -- e.g. are these device props either not substiuted or blank elseif (([string]::IsNullOrWhiteSpace($wmi_user) -and [string]::IsNullOrWhiteSpace($wmi_pass)) -or (($wmi_user -like '*WMI.USER*') -and ($wmi_pass -like '*WMI.PASS*'))) { # no $response = Invoke-Command -ComputerName $hostname -ScriptBlock $scriptBlock } else { # yes. convert user/password into a credential string $remote_pass = ConvertTo-SecureString -String $wmi_pass -AsPlainText -Force; $remote_credential = New-Object -typename System.Management.Automation.PSCredential -argumentlist $wmi_user, $remote_pass; $response = Invoke-Command -ComputerName $hostname -Credential $remote_credential -ScriptBlock $scriptBlock
} exit 0 } catch { # exit code of non 0 will mean the script failed and not overwrite the instances that have already been found throw $Error[0].Exception exit 1 }