Windows
PowerShell for administering Windows endpoints and servers, following the
repository conventions — functional structure,
try/catch error handling, and timestamped logging to C:\Temp.
Everything here runs against the built-in Windows stack: CIM/WMI, ADSI, the registry, and the Windows Update agent. No agent, no module to install, nothing to license.
Scripts in this section
- Local Administrator Inventory — who holds local admin on every machine, with unexpected members flagged. Read-only.
- Patch and Reboot State — last successful update, pending-reboot sources, and uptime, in one row per machine. Read-only.
- Stale Profile Cleanup — reclaims disk from user
profiles nobody has signed into. Changes state; supports
-WhatIf. - Service and Scheduled Task Audit — what runs as whom, plus unquoted paths and writable binary directories. Read-only.
- Certificate Expiry Report — what expires when, and which of it is actually bound to a site. Read-only.
Running these against many machines
The read-only scripts accept -ComputerName and fan out over WinRM:
.\Get-LocalAdminInventory.ps1 -ComputerName (Get-Content .\servers.txt) -Verbose
Three things decide whether that works:
- WinRM is listening and reachable.
Test-WSMan -ComputerName HOSTtells you in one line. In a domain this is usually a GPO; on standalone machines it isEnable-PSRemoting -Forceplus a TrustedHosts entry. - You are an administrator on the target. Local group membership, the Windows
Update agent, and
Win32_UserProfileall require it. Nothing here will tell you anything useful running as a standard user. - Errors are per-machine, not fatal. Each script catches failures against one
host, writes them to the log, records the machine with an
Errorstatus, and continues. A report that silently omits six unreachable machines is worse than one that names them.
Tip — Run the read-only two first
Local Administrator Inventory and Patch and Reboot State change nothing, so they are safe to run broadly on day one. Stale Profile Cleanup deletes data; run it with
-WhatIfand read the output before you ever run it for real.