π¦ ClawHub
Windows
by @ivangdavila
Windows-specific patterns, security practices, and operational traps that cause silent failures.
TERMINAL
clawhub install windowsπ About This Skill
name: Windows description: Windows-specific patterns, security practices, and operational traps that cause silent failures. metadata: category: system skills: ["windows", "powershell", "security", "automation"]
Credential Management
# Store
cmdkey /generic:"MyService" /user:"admin" /pass:"secret"
# Retrieve in script
$cred = Get-StoredCredential -Target "MyService"
Get-Credential and export securely: $cred | Export-Clixml -Path "cred.xml" # Encrypted to current user/machine
$cred = Import-Clixml -Path "cred.xml"
Silent Failures
gpresult /r to see what's actually applied-ErrorAction SilentlyContinue hides problems β use Stop and handle explicitlySymbolic Links
mklink is CMD-only, PowerShell uses New-Item -ItemType SymbolicLinkScript Signing
$cert = Get-ChildItem Cert:\CurrentUser\My -CodeSigningCert
Set-AuthenticodeSignature -FilePath script.ps1 -Certificate $cert
Operational Safety
-WhatIf first on destructive operations β Remove-Item -Recurse -WhatIfStart-Transcript for audit trail β forgotten until incident investigationicacls for CLI, but inheritance rules are non-obvious β test changes on copy firstWinRM Remoting
Enable-PSRemoting -Force isn't enough on workgroupsSet-Item WSMan:\localhost\Client\TrustedHosts -Value "server1,server2"Event Logging
New-EventLog -LogName Application -Source "MyScript" -ErrorAction SilentlyContinue
Write-EventLog -LogName Application -Source "MyScript" -EventId 1000 -Message "Started"
File Locking
try { [IO.File]::OpenWrite($path).Close(); $true } catch { $false }
Temp File Hygiene
$env:TEMP fills silently β scripts should cleanup with try/finally: $tmp = New-TemporaryFile
try { ... } finally { Remove-Item $tmp -Force }
Service Account Gotchas
$env:USERPROFILE points to system profile, not user's\\server\share