Skip to content

Instantly share code, notes, and snippets.

View stephanlinke's full-sized avatar

Stephan Linke stephanlinke

  • Paessler AG
  • Nuremberg
View GitHub Profile
@stephanlinke
stephanlinke / Module.ps1
Created March 28, 2019 12:42
Simple Setup with logging.
#region modules
$requiredModules = @("<modulname>")
$numbers = @{
2 = "two"
3 = "three"
4 = "four"
5 = "five"
6 = "six"
7 = "seven"
@stephanlinke
stephanlinke / PRTG-CheckCertificate
Created December 12, 2018 09:03
This will check the certificate of the given host for it's remaining days. Simply add it to PRTG as a EXE/Script (Advanced) Sensor and use -ComputerName <url-to-the-website>
param(
$ComputerName = "www.google.de",
[Parameter(ValueFromPipelineByPropertyName=$true)]
[int]$Port = 443
)
begin {
$ProtocolNames = [System.Security.Authentication.SslProtocols] | gm -static -MemberType Property | ?{$_.Name -notin @("Default","None")} | %{$_.Name}
#parameters to set in exexml sensor: -target '%host' -instance 'name_of_instance'
param(
[string]$target = '10.0.0.133',
[string]$instance = 'SharePoint - 80'
)
$DataTable = New-Object System.Data.DataTable
@stephanlinke
stephanlinke / PRTG-GetResponseTime.ps1
Created October 9, 2018 13:08
Retrieve the response time for an incident (between sensor being down and acknowledged)
# This requires prtgapi to be installed:
# Install-Module prtgapi
#
# ignore unsigned TLS certificates
add-type @"
using System.Net;
using System.Security.Cryptography.X509Certificates;
public class TrustAllCertsPolicy : ICertificatePolicy {
public bool CheckValidationResult(
ServicePoint srvPoint, X509Certificate certificate,
@stephanlinke
stephanlinke / PRTG-FixDependencies.ps1
Last active June 30, 2023 11:03
Update Master Dependencies throughout PRTG
# USE AT YOUR OWN RISK.
# This will reset the dependencies of all ping sensors to be the master object for their parent.
# Your PRTG Server's FQDN, i.e. prtg.acme.com
$PRTGServer = "prtg.acme.com"
# proper message output
Function This-ShowMessage([string]$type,$message){
@stephanlinke
stephanlinke / PRTG-IIS Aplication Pool.ps1
Last active August 15, 2018 08:22
It will basically do the same/retrieve the same metrics as the IIS App Pool sensor, but using a powershell script to do so. Here's what to do to get the custom sensor running. Installation details can be found at https://kb.paessler.com/en/topic/73440
#parameters to set in exexml sensor: -target '%host' -instance 'name_of_instance'
param(
[string]$target = '10.0.0.133',
[string]$instance = 'SharePoint - 80'
)
$DataTable = New-Object System.Data.DataTable
@stephanlinke
stephanlinke / PRTG-SCVMM-HyperV.ps1
Created July 26, 2018 06:51
PRTG-HyperV - Monitor SCVMM host servers and virtual machines within PRTG
#requires -version 4.0
# ___ ___ _____ ___
#| _ \ _ \_ _/ __|
#| _/ / | || (_ |
#|_| |_|_\ |_| \___|
# SCVMM & HyperV-VM Sensors
# ================================
# This sensor will monitor HyperV hosts and their virtual machines using SCVMM.
# It also supports metascan (https://kb.paessler.com/en/topic/68109), so you don't have
# to do all the configuration work. Note that this will only work in an upcoming stable release
@stephanlinke
stephanlinke / PRTG-GetAutoDiscoveries.ps1
Created April 11, 2018 14:13
Finds all configured auto discoveries in PRTG
[string] $ConfigurationFilePath = ((Get-ItemProperty -Path "hklm:SOFTWARE\Wow6432Node\Paessler\PRTG Network Monitor\Server\Core" -Name "Datapath").DataPath) + "PRTG Configuration.dat"
[xml] $configuration = New-Object -TypeName XML;
$configuration.Load($ConfigurationFilePath)
[System.Collections.ArrayList]$ADEnabledGroups = @();
[System.Collections.ArrayList]$ADEnabledDevices = @();
$Groups = ($configuration.SelectNodes("//group"))
$Devices = ($configuration.SelectNodes("//device"))
@stephanlinke
stephanlinke / PRTG-GetAutomaticServices.ps1
Created April 6, 2018 12:35
Read Status of automatic services on a given host
param(
[string]$computerName="",
[string]$IgnoreList = @("Dell Digital Delivery Service","Skype Updater", "Software Protection","Manager für heruntergeladene Karten"),
[string]$UserName = "",
[string]$Password = ''
)
$IgnoreScript = 'Google Update Service (gupdate)'
$IgnoreCombined = $IgnoreList + $IgnoreScript
@stephanlinke
stephanlinke / PRTG-ResumeNotifications.ps1
Last active December 14, 2017 09:35
Resume all notifications that are paused
$prtgserver="";
$protocol="";
$port=80;
$user="";
$passhash="";
$configpath = "C:\ProgramData\Paessler\PRTG Network Monitor\PRTG Configuration.dat";
[xml]$Configuration = (Get-Content $configpath);
$Notifications = $Configuration.SelectNodes("//notification[@id]")