Кажется, в 3.4.2 поломали userparameters? zabbix_get с сервера возвращает корректное значение с клиента. А в вебинтерфейсе заббикс выводит Unsupported item key про exit code я в курсе, скрипт заканчивается на exit 0 вот он:
Что не так то ? Тип у item текст поставил
Code:
function Test-PendingReboot
{
if (Get-ChildItem "HKLM:\Software\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPending" -EA SilentlyContinue) { return $true }
if (Get-Item "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired" -EA SilentlyContinue) { return $true }
if (Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager" -Name PendingFileRenameOperations -EA SilentlyContinue) { return $true }
try {
$util = [wmiclass]"\\.\root\ccm\clientsdk:CCM_ClientUtilities"
$status = $util.DetermineIfRebootPending()
if(($status -ne $null) -and $status.RebootPending){
return $true
}
}catch{}
return $false
}
$f = Test-PendingReboot
if ($f) {$data = 'NeedReboot'} Else {$data = 'No'}
Write-Output $data
Exit 0
Comment