___ _____ ___ _ _
|_ _|_ _| / __| __ _ _(_)_ __| |_ ___
| | | | \__ \/ _| '_| | '_ \ _(_-<
|___| |_| |___/\__|_| |_| .__/\__/__/
|_|
curl it • pipe it • done
curl -fsSL https://scripts.bonnier.news/bat | bash#!/usr/bin/env bash
set -euo pipefail
echo "🔋 Check battery life on macOS"
ioreg -l | grep -E '"DesignCapacity" =|"AppleRawMaxCapacity"' | grep -o '[0-9]*' | tr '\n' ',' | awk -F"," '{print (int(($2/$1)*1000 + 0.5)/10 "% battery health")}'
irm https://scripts.bonnier.news/oobe-visualizer | iexWrite-Host "Installing required PSWriteHTML module..." -ForegroundColor Cyan
Install-Module -Name PSWriteHTML -Force -AcceptLicense -Scope CurrentUser -ErrorAction SilentlyContinue
Write-Host "Generating OOBE flow diagram..." -ForegroundColor Cyan
# Note: Changed $PSScriptRoot to $env:TEMP so it works when executed from memory
New-HTML -TitleText 'OOBE' -Online -FilePath "$env:TEMP\OOBE.html" {
New-HTMLPanel {
New-HTMLDiagram -Height '2000px' -Width '3000px' {
New-DiagramOptionsInteraction -Hover $true
New-DiagramOptionsPhysics -Enabled $true
New-DiagramOptionsLayout -RandomSeed 0
New-DiagramOptionsLinks -ArrowsToEnabled $true -Color BlueViolet -ArrowsToType arrow -ArrowsFromEnabled $false
New-DiagramOptionsNodes -BorderWidth 1 -FontColor Black -Size 16 -FontMulti true
$file = "C:\Windows\SystemApps\Microsoft.Windows.CloudExperienceHost_cw5n1h2txyewy\data\prod\navigation.json"
if (-not (Test-Path $file)) {
Write-Warning "Could not find the OOBE navigation.json file on this system."
return
}
$nav = Get-Content $file | ConvertFrom-Json -Depth 999 -AsHashtable
$nav.FRXINCLUSIVE.Keys | Where-Object { $nav.FRXINCLUSIVE.$_.count -gt 1} | ForEach-Object {
Write-Host "Mapping Node: $_"
New-DiagramNode -Label "$_" -IconSolid desktop -Title "$_"
if ($null -ne $nav.FRXINCLUSIVE.$_.successID) {
New-DiagramLink -From "$_" -To "$($nav.FRXINCLUSIVE.$_.successID)"
}
}
}
}
} -ShowHTMLirm https://scripts.bonnier.news/sccm-cycles | iex# Source - https://stackoverflow.com/a/70869951
# Posted by Suncat2000, Retrieved 2026-04-01, License - CC BY-SA 4.0
# Modified for in-memory execution, GPUpdate, and UI improvements
# 1. Smart Self-Elevation (Handles both local .ps1 files and in-memory execution)
$isAdmin = ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
if (-Not $isAdmin) {
Write-Warning "Administrator privileges required. Attempting to elevate..."
if ($PSCommandPath) {
# Executed from a local file (Debugging)
Start-Process -FilePath PowerShell.exe -Verb Runas -ArgumentList "-NoProfile -File `"$PSCommandPath`""
} else {
# Executed in-memory via 'irm | iex'
$ElevatedCommand = "-NoProfile -Command `"irm http://192.168.250.1:7676/sccm-cycles | iex`""
Start-Process -FilePath PowerShell.exe -Verb Runas -ArgumentList $ElevatedCommand
}
Exit
}
# 2. Define the SCCM Cycles with descriptions
$sccmCycles = @(
[pscustomobject]@{ ID = "{00000000-0000-0000-0000-000000000001}"; Name = "Hardware Inventory Cycle" }
[pscustomobject]@{ ID = "{00000000-0000-0000-0000-000000000002}"; Name = "Software Inventory & Collect Files" }
[pscustomobject]@{ ID = "{00000000-0000-0000-0000-000000000003}"; Name = "Discovery Data Collection (Heartbeat)" }
[pscustomobject]@{ ID = "{00000000-0000-0000-0000-000000000010}"; Name = "Software Metering Usage Report Cycle" }
[pscustomobject]@{ ID = "{00000000-0000-0000-0000-000000000021}"; Name = "Request Machine Assignments" }
[pscustomobject]@{ ID = "{00000000-0000-0000-0000-000000000022}"; Name = "Evaluate Machine Policies" }
[pscustomobject]@{ ID = "{00000000-0000-0000-0000-000000000031}"; Name = "Software Metering Generate Usage Report" }
[pscustomobject]@{ ID = "{00000000-0000-0000-0000-000000000040}"; Name = "Machine Policy Agent Cleanup" }
[pscustomobject]@{ ID = "{00000000-0000-0000-0000-000000000042}"; Name = "Policy Agent Validate Machine Policy" }
[pscustomobject]@{ ID = "{00000000-0000-0000-0000-000000000105}"; Name = "Get IDMIF Files" }
[pscustomobject]@{ ID = "{00000000-0000-0000-0000-000000000108}"; Name = "Software Updates Evaluation Cycle" }
[pscustomobject]@{ ID = "{00000000-0000-0000-0000-000000000111}"; Name = "Windows PE Peer Cache Cleanup" }
[pscustomobject]@{ ID = "{00000000-0000-0000-0000-000000000113}"; Name = "Software Updates Scan Cycle" }
[pscustomobject]@{ ID = "{00000000-0000-0000-0000-000000000114}"; Name = "Windows Installer Source List Update" }
[pscustomobject]@{ ID = "{00000000-0000-0000-0000-000000000115}"; Name = "State Message Manager Delivery" }
[pscustomobject]@{ ID = "{00000000-0000-0000-0000-000000000121}"; Name = "Application Manager Machine Policy Action" }
[pscustomobject]@{ ID = "{00000000-0000-0000-0000-000000000131}"; Name = "Power Management Client Activity" }
)
Write-Host ""
Write-Host "===========================================================" -ForegroundColor Cyan
Write-Host " Initiating System Sync & Configuration Cycles" -ForegroundColor White
Write-Host "===========================================================" -ForegroundColor Cyan
Write-Host ""
# 3. Group Policy Update
Write-Host " > Triggering " -NoNewline
Write-Host "$("Group Policy Update (gpupdate)".PadRight(45))" -ForegroundColor Yellow -NoNewline
try {
# Pipe output to $null to keep the console clean while it waits
$null = gpupdate.exe /force /Wait:-1 2>&1
if ($LASTEXITCODE -eq 0) {
Write-Host "[ OK ]" -ForegroundColor Green
} else {
Write-Host "[WARN]" -ForegroundColor DarkYellow
}
} catch {
Write-Host "[FAIL]" -ForegroundColor Red
}
# 4. SCCM Cycles
foreach ($cycle in $sccmCycles) {
Write-Host " > Triggering " -NoNewline
Write-Host "$($cycle.Name.PadRight(45))" -ForegroundColor Yellow -NoNewline
try {
$null = Invoke-WMIMethod -Namespace root\ccm -Class SMS_CLIENT -Name TriggerSchedule -ArgumentList $cycle.ID -ErrorAction Stop
Write-Host "[ OK ]" -ForegroundColor Green
} catch {
Write-Host "[FAIL]" -ForegroundColor Red
}
}
Write-Host ""
Write-Host "===========================================================" -ForegroundColor Cyan
Write-Host " Sync completed!" -ForegroundColor Green
Write-Host "===========================================================" -ForegroundColor Cyan
Write-Host ""