This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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 | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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)" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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 |