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-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 / 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-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]")
@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
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 / 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")