Navigation Menu

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 / PRTG-SendCustomHTMLNotifications.ps1
Last active March 22, 2024 08:29
[Send Custom HTML Notifications] Recently, we changed the way PRTG handles notification emails and simplified the approach so there is only one email template and the option to deliver plain text emails. For most of our customers this will be sufficient. But what about customers that have multiple clients and need customized notifications, langu…
#Requires -Version 4
<#
___ ___ _____ ___
| _ \ _ \_ _/ __|
| _/ / | || (_ |
|_| |_|_\ |_| \___|
HTMLMailNotifier
With this, you can send personalized HTML mails using templates and PRTGs EXE notification
#>
param(
@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-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-ImportDevicesFromCSV.ps1
Last active February 18, 2022 19:58
[Import Devices From CSV List] This script allows you to import devices from a CSV into PRTG, including their lat/lon location. #PRTG #management
#Requires -Version 4
# ___ ___ _____ ___
#| _ \ _ \_ _/ __|
#| _/ / | || (_ |
#|_| |_|_\ |_| \___|
# NETWORK MONITOR
# ------------------
# (c) 2014 Paessler AG
# this will create new devices including lat and lon. from a CSV.
# Make sure it looks like this and is named devices.csv within the same directory as the script:
@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}
@stephanlinke
stephanlinke / PRTG-CheckWebLogin.ps1
Last active April 24, 2021 22:57
[CheckWebLogin] A Script Sensor for PRTG that will allow you to check websites behind a form based login #PRTG #prtgexe
# ___ ___ _____ ___
#| _ \ _ \_ _/ __|
#| _/ / | || (_ |
#|_| |_|_\ |_| \___|
# NETWORK MONITOR
#-------------------
# Description: Monitors if a login on a website with a HTML login form works properly
# Parameters:
# -URL: The URL to the login form
# -Username: A valid username for the page
@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 / 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"
#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