Skip to content

Instantly share code, notes, and snippets.

View markwragg's full-sized avatar

Mark Wragg markwragg

View GitHub Profile
@markwragg
markwragg / Get-Uptime.ps1
Last active September 12, 2016 10:26
Powershell script for getting the uptime of multiple Windows servers using WMI : http://wragg.io/get-uptime-from-multiple-servers/
#Requires -version 2.0
[CmdletBinding()]
param (
[ValidateSet("London","Berlin","Tokyo","")][string]$location
)
Write-Host ("`n" * 5)
Import-Module ActiveDirectory -Cmdlet get-adcomputer
$Servers = get-adcomputer -filter {Enabled -eq $true -and OperatingSystem -Like "Windows*"} -property Enabled,OperatingSystem | ?{$_.DistinguishedName.contains($location)}
@markwragg
markwragg / Get-PRTGTransactionSensorURLSetting.ps1
Last active September 12, 2016 10:29
Powershell script for getting the URL step settings from all HTTP Transaction sensors in PRTG : http://wragg.io/get-transaction-sensor-url-settings-from-prtg-with-powershell/
[CmdletBinding()]
Param(
$PRTGURL = "https://{your prtg URL}/api",
$Auth = "username={your prtg user}&passhash={your prtg password hash}"
)
$Sensors = ""
$Sensors = (invoke-restmethod "$PRTGURL/table.json?content=sensors&output=json&columns=objid,probe,group,device,sensor,status&count=10000&filter_type=httptransaction&$Auth").sensors
$i = 1
@markwragg
markwragg / Get-PRTGSensorAutoAckSetting.ps1
Last active February 18, 2022 19:26
Powershell script for returning the Auto Acknowledge setting for all Ping sensors in PRTG using the API.
[CmdletBinding()]
Param(
$PRTGURL = "https://{your PRTG URL}/api",
$Auth = "username={your username}&passhash={your password hash}",
$SensorType = "ping"
)
$Sensors = ""
$Sensors = (invoke-restmethod "$PRTGURL/table.json?content=sensors&output=json&columns=objid,probe,group,device,sensor,status&count=10000&filter_type=$SensorType&$Auth").sensors