Skip to content

Instantly share code, notes, and snippets.

View dstreefkerk's full-sized avatar

Daniel dstreefkerk

  • Sydney, Australia
View GitHub Profile
@randomvariable
randomvariable / dns_client_log.ps1
Last active October 25, 2024 01:36
DNS Client Logging on Windows
function Start-DNSClientLog {
$DnsOpLog = Get-WinEvent -ListLog Microsoft-Windows-DNS-Client/Operational
$DnsOpLog.IsEnabled = $true
$DnsOpLog.SaveChanges()
}
function Get-DNSClientQueries {
foreach($event in (get-winevent Microsoft-Windows-DNS-Client/Operational | % { [xml]$_.ToXml() })) {
$Query = ($event.Event.EventData.Data | Where-Object { $_.Name -eq "QueryName" }).'#text'
@leeramsay
leeramsay / PSADT-Cheatsheet.ps1
Last active November 12, 2024 19:46
PSADT snippits/cheatsheet
## Commonly used PSADT env variables
$envCommonDesktop # C:\Users\Public\Desktop
$envCommonStartMenuPrograms # C:\ProgramData\Microsoft\Windows\Start Menu\Programs
$envProgramFiles # C:\Program Files
$envProgramFilesX86 # C:\Program Files (x86)
$envProgramData # c:\ProgramData
$envUserDesktop # c:\Users\{user currently logged in}\Desktop
$envUserStartMenuPrograms # c:\Users\{user currently logged in}\AppData\Roaming\Microsoft\Windows\Start Menu\Programs
$envSystemDrive # c:
$envWinDir # c:\windows
@dampee
dampee / umbraco db cleanup.sql
Last active November 9, 2021 12:57
Umbraco Database cleanup. After pulling in an umbraco database from production, you don't need all history or log.
-- Umbraco Clear Old Document Versions To Decrease Database Size And Improve Performance
-- http://borism.net/2008/12/16/fixing-a-large-cmspropertydata-table-in-umbraco/
DECLARE @createdDate Datetime = DATEADD(m, -1, getdate())
-- dump logs
-- TRUNCATE TABLE umbracolog -- faster if log table is very big and you don't need anything
DELETE FROM umbracolog WHERE Datestamp < @createdDate
-- clean up old versions
DELETE FROM cmsPropertyData WHERE
@bklockwood
bklockwood / offlinewucheck.ps1
Last active March 3, 2022 04:05
Powershell offline WU check
<#
This script performs the 'search' phase of a Windows Update, using the standard WUA API.
It does not download or install updates.
Sole purpose of this script is to find out how long it takes to download the required cabfile,
then process it against a live system and return the list of updates available for that system.
#>
function DownloadFile {
param (
[Parameter(Mandatory=$true,Position=0)] $url,
[Parameter(Mandatory=$true,Position=1)] $file