Skip to content

Instantly share code, notes, and snippets.

# Original from here: https://gallery.technet.microsoft.com/A-PowerShell-Happy-983c1253
$BeepList = @(
@{ Pitch = 1000; Length = 300; };
@{ Pitch = 1000; Length = 200; };
@{ Pitch = 1150; Length = 500; };
@{ Pitch = 1000; Length = 500; };
@{ Pitch = 1350; Length = 500; };
@{ Pitch = 1250; Length = 800; };
#documentation: https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/windows-scripting/x83z1d9f(v=vs.84)
$title = "Message from IT"
$message = "Click Ok to update the application now or Cancel to exit."
$secondsToWait = 120 # seconds for the window to be visible. 0 seconds will wait until user closes the window.
$wshell = New-Object -ComObject Wscript.Shell # Create message box object
$exitcode = $wshell.Popup($message, $secondsToWait, $title, 0x1031) #1000 = start on top; 0030 = warning icon; 0001 = Ok/Cancel buttons
# $exitcode 1 = OK button, 2 = Cancel button, -1 = Msg box closed after $seconsdToWait timed out
exit $exitcode
@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
@stevenpdq
stevenpdq / Apply-SlackDarkTheme.ps1
Created June 11, 2019 16:24
Applies dark theme to Slack
# Find ssb-interop.js file thata needs to be patched
# Test-Path Machine-Wide 64-bit install
If (Test-Path "C:\Program Files\Slack\resources\app.asar.unpacked\src\static\ssb-interop.js") {
$ssbinteropPath = "C:\Program Files\Slack\resources\app.asar.unpacked\src\static\ssb-interop.js"
$exePath = "C:\Program Files\Slack\Slack.exe"
}
# Test-Path Machine-Wide 32-bit install
ElseIf (Test-Path "C:\Program Files (x86)\Slack\resources\app.asar.unpacked\src\static\ssb-interop.js") {
$ssbinteropPath = "C:\Program Files (x86)\Slack\resources\app.asar.unpacked\src\static\ssb-interop.js"
$exePath = "C:\Program Files (x86)\Slack\Slack.exe"
@stevenpdq
stevenpdq / AppsNewToEnvironment.sql
Last active February 21, 2019 17:32
PDQ Inventory SQL Report query to list applications new to environment in the last 7 days
SELECT
Computers.Name as "Computer",
Applications.Name as "Application",
Applications.InstallDate
FROM Computers
JOIN Applications on Applications.ComputerId = Computers.ComputerId
WHERE Applications.InstallDate > date('now', '-7 day')
AND Applications.Name NOT IN
(SELECT
Applications.Name
@stevenpdq
stevenpdq / ListDuplicateApplications.sql
Last active November 20, 2020 13:56
PDQ Inventory SQL Report query to list duplicate applications
SELECT
Computers.Name as "Computer",
group_concat(Applications.Name, ", ") "Applications",
Count(Computers.Name) as Count
FROM Applications
JOIN Computers on Computers.ComputerId=Applications.ComputerId
WHERE Applications.Name LIKE "Java SE Development Kit 8%"
GROUP by Computers.Name
HAVING Count(Computers.Name) > 1