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-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-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-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:
CREATE PROCEDURE spPlanResult
@nvcPlanName nvarchar(255)
AS
BEGIN
SELECT TOP 1 succeeded
FROM msdb.dbo.sysmaintplan_log PL
INNER JOIN msdb.dbo.sysmaintplan_plans PP ON PP.id = PL.plan_id
WHERE PP.name = @nvcPlanName
ORDER BY start_time desc
@stephanlinke
stephanlinke / PRTG-GetCounters.ps1
Last active October 2, 2017 09:09
[Read IIS Counters] It will basically do the same/retrieve the same metrics as the IIS App Pool sensor, but using a powershell script to do so. The culprit however is, that in order to work properly you need to configure PRTG's Probe service to run in the context of a user that is allowed to access the targeted hosts (by default it runs in the c…
#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-CheckSMBFiles.ps1
Last active August 28, 2018 02:00
[Check SMB Files] This script will display the amount of files opened via network shares on the given host #PRTG #PRTGexexml
param($computerName = "")
# start a new powershell session
$session = New-PSSession -ComputerName $computerName
# execute the command and retrieve currently open files
$files = (Invoke-Command -Session $session -ScriptBlock {Get-SmbOpenFile | Group Path})
# write to log file
#$files | Out-File "C:\temp\smb.log" -Append
@stephanlinke
stephanlinke / SNMP-Installer.ps1
Last active August 28, 2017 08:29
Installing SNMP via Script
####################################
# Last update: 20150310pra
# Original: https://community.whatsupgold.com/library/powershellscripts/installandconfiguresnmpwithpowershell
# Description: Powershell script to install and configure SNMP Services on Windows 2008R2, 2012 and 2012R2 Server (SNMP Service, SNMP WMI Provider)
# start As Administrator with C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -executionpolicy bypass -Command "&{ \\Servername\InstallSNMP\installsnmp.ps1}"
# Script Location: \\Servername\InstallSNMP\installsnmp.ps1
####################################
#Variables :)
$PManagers = @("172.29.60.206") # ADD YOUR MANAGER(s) in format @("manager1","manager2")
@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]")
@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-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"))