Skip to content

Instantly share code, notes, and snippets.

View TheRemote's full-sized avatar

James A. Chambers TheRemote

View GitHub Profile
@TheRemote
TheRemote / gist:9eecee26022bc611ef8929f12381e6eb
Created April 27, 2026 01:42
Tracking User Lock, Unlock, and Sleep Events with PowerShell
# Accompanies blog article at https://jamesachambers.com/tracking-user-lock-unlock-and-sleep-events-with-powershell/
# Tracks User Lock, Unlock, and Sleep Events with PowerShell
$startTime = (Get-Date).AddDays(-3)
$securityEvents = Get-WinEvent -FilterHashtable @{
LogName = 'Security'
ID = 4800, 4801, 4802, 4803, 4779, 4647
StartTime = $startTime
}
@TheRemote
TheRemote / gist:3e57c94597b8044694816bd1413630fb
Created April 26, 2026 19:06
Auditing External SharePoint File Sharing with PowerShell
# Blog article at https://jamesachambers.com/auditing-external-file-sharing-in-microsoft-365-with-powershell/
# Get SharePoint or OneDrive sites (adjust for specific sites or drives if needed)
$sites = Get-MgSite -All
# Initialize an array to store results
$externallySharedFiles = @()
# Loop through each site and its drives (OneDrive and SharePoint sites)
foreach ($site in $sites) {
Write-Host "Checking site: $($site.DisplayName)"
@TheRemote
TheRemote / gist:84f994a45a251ed6f0a0fbce707bfd5c
Last active April 26, 2026 18:17
Fix-WindowsUpdate.ps1 - Reset Microsoft Windows Update
# For my blog article at https://jamesachambers.com/the-nuclear-option-a-powershell-script-to-reset-windows-update-completely/
# Fix-WindowsUpdate.ps1 — Reset Windows Update to a clean state
"Setting Windows Update settings..."
if (-Not (Test-Path "HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate\AU")) {
New-Item -Path "HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate\AU"
}
Set-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate\AU" -Name 'AUOptions' -Value 4 -Verbose -ErrorAction SilentlyContinue
Set-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate\AU" -Name 'AutomaticMaintenanceEnabled' -Value 1 -Verbose -ErrorAction SilentlyContinue
Set-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate\AU" -Name 'NoAutoUpdate' -Value 0 -Verbose -ErrorAction SilentlyContinue
@TheRemote
TheRemote / CoreKeeperFishing.ps1
Created March 2, 2025 15:52
Core Keeper Fishing Bot
# https://jamesachambers.com/making-a-core-keeper-fishing-bot-using-ai-grok-3/
# Define the MouseSimulator class to handle mouse events
Add-Type -TypeDefinition @"
using System;
using System.Runtime.InteropServices;
public class MouseSimulator {
[DllImport("user32.dll", SetLastError = true)]
public static extern void mouse_event(uint dwFlags, uint dx, uint dy, uint dwData, IntPtr dwExtraInfo);
@TheRemote
TheRemote / measurepi.sh
Last active November 29, 2024 12:31
Measure Raspberry Pi CPU / GPU / Core / SD clock speeds and check whether you are undervolted
#!/bin/bash
# This bash script outputs the status of your Pi and checks whether you are being throttled for undervoltage and gives you your temperature
# Article and discussion at https://jamesachambers.com/measure-raspberry-pi-undervoltage-true-clock-speeds/
# Author James A Chambers 6-6-17
# Output current configuration
vcgencmd get_config int | egrep "(arm|core|gpu|sdram)_freq|over_volt"
# Measure clock speeds
for src in arm core h264 isp v3d; do echo -e "$src:\t$(vcgencmd measure_clock $src)"; done