I would like to get information about the Powershell Version which runs my custom Powershell Sensor.


Article Comments

You can use two very short scripts to gather information on the Powershell Sessions which execute your custom scripts on your computer.

Create a 'ps1' file in your Custom Sensors Folder of PRTG and enter this line:

write-host $Host.Version.Major,":OK ",$Host.Version.Major,".",$Host.Version.Minor

Create a Custom Sensor using the scriptfile you have just created. The script will return the version number of Powershell when executed.

To determine if the Powershell Session runs in a 32bit or 64bit environment create a script containing the following lines:

  if ([System.IntPtr]::Size -eq 8)
    {
      write-host 64,":64bit Session"
    }
    else
    {
      write-host 32,":32bit Session"
    }

Create an EXE/Script sensor for the script you just created, and it will return the environment of the Powershell Session.


May, 2011 - Permalink

See Also

Force 64-bit PowerShell?


May, 2011 - Permalink