We are trying to monitor the RemoteQueueLength in WMI for IIS6 SMTP on Windows Server 2012R2. PRTG returns the following from running a batch file calling the 64bit version of Powershell. We did try just running it under the native 32bit Powershell that PRTG utilizes still.
C:\Windows\system32>C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe -file "C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML\checkSMTPQueue.ps1" Get-WmiObject : Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESS DENIED)) At C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML\checkSMTPQ ueue.ps1:3 char:28 + $SMTPObject = Get-WmiObject <<<< -Query "SELECT RemoteQueueLength,MessageSen dRetries,NDRsGenerated,OutboundConnectionsRefused,OutboundConnectionsTotal,Remo teRetryQueueLength,TotalMessagesSubmitted from Win32_PerfRawData_SMTPSVC_SMTPSe rver Where Name='_Total'" -ComputerName server01a + CategoryInfo : NotSpecified: (:) [Get-WmiObject], UnauthorizedA ccessException + FullyQualifiedErrorId : System.UnauthorizedAccessException,Microsoft.Pow erShell.Commands.GetWmiObjectCommand <prtg> <result><channel>RemoteQueueLength</channel><value></value></result> </prtg>
From the 64bit powershell command line, it works:
PS> Get-WmiObject -Query "SELECT RemoteQueueLength from Win32_PerfRawData_SMTPSVC_SMTPSe rver Where Name ='_Total'" -ComputerName server01a __GENUS : 2 __CLASS : Win32_PerfRawData_SMTPSVC_SMTPServer __SUPERCLASS : __DYNASTY : __RELPATH : __PROPERTY_COUNT : 1 __DERIVATION : {} __SERVER : __NAMESPACE : __PATH : RemoteQueueLength : 0
From the 32bit powershell command line, it fails:
PS C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML> Get-WmiObject -Query "SELECT RemoteQueueLength from Win32_PerfRawData_SMTPSVC_SMTPServer Where Name ='_Total'" -ComputerName server01 Get-WmiObject : Invalid class At line:1 char:14 + Get-WmiObject <<<< -Query "SELECT RemoteQueueLength from Win32_PerfRawData_SMTPSVC_SMTPServer Where Name ='_Total'" -ComputerName v-smtp-02a + CategoryInfo : InvalidOperation: (:) [Get-WmiObject], ManagementException + FullyQualifiedErrorId : GetWMIManagementException,Microsoft.PowerShell.Commands.GetWmiObjectCommand
Any thoughts on how to get PRTG to monitor queue info? Have we simply over thought it and there is a simpler solution?
Add comment