Skip to content

Instantly share code, notes, and snippets.

View AndrewPla's full-sized avatar
🌠
Shooting for the stars!

Andrew Pla AndrewPla

🌠
Shooting for the stars!
View GitHub Profile
@stevenpdq
stevenpdq / Get-PDQEventLogs.ps1
Last active December 23, 2022 18:05
Gathers event logs related to PDQ Deploy, PDQ Inventory, PDQ Inventory Agent, and .NET from the last 30 days into an evtx file
$OutputPath = $env:TEMP
#xPathQuery for wevutil to grab event logs from Deploy, Inventory, Inventory Agent, and .NET Runtime from the last 30 days:
$xPathQuery = "*[System[Provider[@Name='PDQ Deploy' or @Name='PDQ Inventory' or @Name='PDQ Inventory Agent' or @Name='.NET Runtime'] and TimeCreated[timediff(@SystemTime) <= 2592000000]]]"
wevtutil export-log Application $OutputPath\PDQEventLogs.evtx /query:"$xPathQuery" /overwrite:true #export event logs to evtx file based on xPathQuery
$wshell = New-Object -ComObject Wscript.Shell # Create message box
$wshell.Popup("Log files saved at $OutputPath\PDQEventLogs.evtx.`n`nClick Ok to open containing folder.", 0, "PDQ Event Logs", 0x0)
Invoke-Item $OutputPath #Open up the Log folder in explorer for easy access to PDQEventLogs.evtx
@JustinGrote
JustinGrote / Search-Giphy.ps1
Last active December 23, 2022 16:18
Get a random gif from Giphy. ***NOTE: Invoke-TerminalGif was moved to MSTerminalSettings module***
#requires -module msterminalsettings,threadjob
###QUICKSTART
#FIRST: Run this in your Powershell Windows Terminal: Install-Module threadjob,msterminalsettings -scope currentuser
#THEN: iex (iwr git.io/invoketerminalgif)
#THEN: Get-Help Search-Giphy -Examples
#THEN: Get-Help Invoke-TerminalGif -Examples
#THEN: Search-Giphy | Format-List -prop *
#THEN: Invoke-TerminalGif https://media.giphy.com/media/g9582DNuQppxC/giphy.gif
@JustinGrote
JustinGrote / Add-PrtgSnmpLibrarySensor.ps1
Created April 5, 2019 04:53
Autodiscover a PRTG SNMP Library and add the appropriate sensor via PRTGAPI
#requires -module PrtgApi,PowerHtml
function New-PrtgMethodParams {
[CmdletBinding()]
param (
[Parameter(Mandatory)]$Command,
$Body = ([ordered]@{}),
$Method = 'GET',
$client = (Get-PRTGClient),
[Switch]$NoCredential
)
@pcgeek86
pcgeek86 / cheatsheet.ps1
Last active June 7, 2024 18:23
PowerShell Cheat Sheet / Quick Reference
Get-Command # Retrieves a list of all the commands available to PowerShell
# (native binaries in $env:PATH + cmdlets / functions from PowerShell modules)
Get-Command -Module Microsoft* # Retrieves a list of all the PowerShell commands exported from modules named Microsoft*
Get-Command -Name *item # Retrieves a list of all commands (native binaries + PowerShell commands) ending in "item"
Get-Help # Get all help topics
Get-Help -Name about_Variables # Get help for a specific about_* topic (aka. man page)
Get-Help -Name Get-Command # Get help for a specific PowerShell function
Get-Help -Name Get-Command -Parameter Module # Get help for a specific parameter on a specific command
@AndrewPla
AndrewPla / Parse-TOPdeskAccessLog.ps1
Last active March 6, 2020 18:33
Downloads access log from TOPdesk. We then extract the logfile from the zip and parse it. Finally we output an object. I blogged about this at: https://andrewpla.dev/Inspect-TOPdesk-Access-Logs/
<#
.Parameter Credential
Enter WEBdav creds for an account with the WEBDav Read permission
.Parameter TOPdeskURL
The URL of the topdesk instance. eg: Support.Company.com, company.topdesk.net
.Parameter OutputFolder
Folder where you want the logs to be downloaded to. If not provided, the files will be downloaded into your tmp folder and will be cleaned up at the end.
.Parameter MonthsBack
Select how many months back you want to go. Default select the current month. 1 would be for this month, 3 whereas 3 would be the last 3 months
.Parameter DaysBack
@IISResetMe
IISResetMe / Get-AuditPolicy.ps1
Last active January 11, 2022 10:53
Poor man's audit policy parser
#Requires -Version 5
# Define AuditSetting enum
[System.Flags()]
enum AuditSetting {
None = 0
Success = 1
Failure = 2
All = 3
}
@AndrewPla
AndrewPla / Download-Latest_TOPdesk_Backup.ps1
Created January 28, 2019 14:01
Download the latest backup from TOPdesk using PowerShell.
# Credential needs to
$Credential = Get-Credential -Message 'enter TOPdesk operator credential with WebDAV permissions.'
$OutputFolder = 'C:\path\to\folder'
$tdurl = 'company.topdesk.net'
$psDriveParams = @{
PSProvider = 'FileSystem'
Root = "\\$tdUrl@SSL\webdav" # ex: '\\contoso.topdesk.net@SSL\webdav'
Credential = $Credential
Name = 'TOPdesk'
@steviecoaster
steviecoaster / Start-Deployment.ps1
Last active December 5, 2018 22:05
PDQ Deploy bootstrap script
Function Start-Deployment {
<#
.SYNOPSIS
Start a PDQ Deploy Deployment on a target machine
.DESCRIPTION
Trigger a PDQ Deploy deployment to start locally or on a remote machine with PDQ Deploy installed
.EXAMPLE
Start-Deployment -PackageName "Example Package" -Targets "Wolverine"
<#PSScriptInfo
.VERSION 0.1.0
.GUID 05c41fde-bd40-4dd3-a72e-12ec14a50676
.AUTHOR Tyler Leonhardt
.COMPANYNAME Tyler Leonhardt
@JustinGrote
JustinGrote / Get-PRTGDeviceSysInfo.ps1
Created August 15, 2018 20:25
Function to retrieve PRTG Device System Information
#requires -module PrtgAPI -version 5
using namespace PrtgAPI
function Get-PRTGDeviceSysInfo {
<#
.SYNOPSIS
Retrieve PRTG Device System Information via the (undocumented) API.
.EXAMPLE
Get-PRTGDeviceSysInfo -ID 13926