Hello,

could you explain how to create a custom sensor to know the current OS version on PowerShell? The command is the following:

Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion' -Name ReleaseID | Select-Object ReleaseID

The result should be the release number and if I run manually it works, but from PRTG custom sensor never works for me.

Thanks in advance , regards.


Article Comments

Hi Roberto,

first, please make sure that you check the requirements for PowerShell sensors thoroughly: https://helpdesk.paessler.com/en/support/solutions/articles/76000041700-guide-for-powershell-based-custom-sensors

Note that the PowerShell script is always executed on the Probe system. So, if you want to check the windows versions of remote hosts, you will have to use Remote PowerShell commands.


Kind regards, Matthias Kupfer - Team Tech Support


Dec, 2020 - Permalink

Hello,

ExecutionPolicy is RemoteSigned on PRTG core and PRTG probe system. I'm trying to know the reason about the issue on custom sensor. If I copy the PowerShell sintaxis on destiny computer works, but I paste on .ps1 and then I run from custom sensor PRTG fails.

Could you provide more information or an example please?

Thanks in advance, regards.


Dec, 2020 - Permalink

Hi,

you need to execute the command remotely, with Invoke-Command. Please take a look at the following links for examples and instructions:

Please also take a look at our Sensor-Hub and filter for "Script Language" PowerShell. This will provide you existing PowerShell script sensors:


Kind regards,
Matthias Kupfer - Team Tech Support


Dec, 2020 - Permalink

Using our Custom Sensor WinOSVersion the output will be something like:

10019041:Microsoft Windows 10 Pro 64-bit
or
639600:Microsoft Windows Server 2012 R2 Standard 64-bit

The sensor takes one mandatory and two optional parameters:

-c=   The ip-address or hostname of the computer to query.
-u=   Optional Domain\Username of a user account hat has access to the computer via WMI service.
-p=   Optional Password of a user account that has access to the computer via WMI service.

The sensor can be downloaded here


Sensors | Multi Channel Sensors | Tools | Notifications

Kind regards,

[[https://prtgtoolsfamily.com]] PRTG Tools Family


Jan, 2021 - Permalink

Hello,

thanks for your reply, my intention is to obtain the ReleaseId. WinOSVersion sensor is already implemented on my PRTG. But I can't obtain "1809" for example for my desktop with Win10 OS Version.

After create custom sensor with above sintaxis, fails. If I am not wrong, I followed all steps correctly.

Thanks.


Jan, 2021 - Permalink

Hello Roberto,

I'm sorry to hear that the WinOSVersion Custom Sensor is not working for you. Can you send a screenshot running the .exe with its parameters from a command line to mailto:support@prtgtoolsfamily.com ?


Sensors | Multi Channel Sensors | Tools | Notifications

Kind regards,

[[https://prtgtoolsfamily.com]] PRTG Tools Family


Jan, 2021 - Permalink

Hello Roberto, PRTG Tools Family,

To get the release id of Windows OS, you can create a small PowerShell script which executes the following command locally or remotely:

(Get-Item "HKLM:SOFTWARE\Microsoft\Windows NT\CurrentVersion").GetValue('ReleaseID')

Then, to execute the script you can use one of the EXE/Script sensors. Here is the manual regarding custom sensors: https://www.paessler.com/manuals/prtg/custom_sensors.

If you have questions, let us know.

Regards.


Jan, 2021 - Permalink