Back to skills
SKILL.md
Windows
ASecurityWindows-specific patterns, security practices, and operational traps that cause silent failures.
- 17 stars
- 0 votes
- 0 copies
- 6 views
- Added September 6, 2026
Works with
Security analysis
100/100Pro scans all 2 files and shows the line behind each finding
npx -y skills add clawic/skills --skill windows --agent claude-codeAre you the author of Windows?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/clawic-windows)---
name: Windows
slug: windows
version: 1.0.0
description: Windows-specific patterns, security practices, and operational traps that cause silent failures.
homepage: https://clawic.com/skills/windows
metadata:
category: system
skills:
- windows
- powershell
- security
- automation
clawdbot:
emoji: ๐ช
displayName: Windows
---
## Credential Management
- Never hardcode passwords in scripts โ use Windows Credential Manager:
```powershell
# Store
cmdkey /generic:"MyService" /user:"admin" /pass:"secret"
# Retrieve in script
$cred = Get-StoredCredential -Target "MyService"
```
- For scripts, use `Get-Credential` and export securely:
```powershell
$cred | Export-Clixml -Path "cred.xml" # Encrypted to current user/machine
$cred = Import-Clixml -Path "cred.xml"
```
## Silent Failures
- Windows Defender silently quarantines downloaded scripts/executables โ check quarantine if script disappears
- Group Policy overrides local settings silently โ `gpresult /r` to see what's actually applied
- Antivirus real-time scanning blocks file operations intermittently โ add exclusions for build/automation folders
- PowerShell `-ErrorAction SilentlyContinue` hides problems โ use `Stop` and handle explicitly
## Symbolic Links
- Creating symlinks requires admin OR SeCreateSymbolicLinkPrivilege โ regular users fail silently
- Enable Developer Mode for symlinks without admin: Settings โ For Developers โ Developer Mode
- `mklink` is CMD-only, PowerShell uses `New-Item -ItemType SymbolicLink`
## Script Signing
- Unsigned scripts fail on restricted machines with confusing errors โ sign for production:
```powershell
$cert = Get-ChildItem Cert:\CurrentUser\My -CodeSigningCert
Set-AuthenticodeSignature -FilePath script.ps1 -Certificate $cert
```
- AllSigned policy requires ALL scripts signed including profile.ps1
## Operational Safety
- Always `-WhatIf` first on destructive operations โ `Remove-Item -Recurse -WhatIf`
- `Start-Transcript` for audit trail โ forgotten until incident investigation
- NTFS permissions: `icacls` for CLI, but inheritance rules are non-obvious โ test changes on copy first
## WinRM Remoting
- Enable correctly: `Enable-PSRemoting -Force` isn't enough on workgroups
- Workgroup machines need TrustedHosts: `Set-Item WSMan:\localhost\Client\TrustedHosts -Value "server1,server2"`
- HTTPS remoting needs certificate setup โ HTTP sends credentials readable on network
## Event Logging
- Scripts should log to Windows Event Log for centralized monitoring:
```powershell
New-EventLog -LogName Application -Source "MyScript" -ErrorAction SilentlyContinue
Write-EventLog -LogName Application -Source "MyScript" -EventId 1000 -Message "Started"
```
- Custom event sources require admin to create โ create during install, not runtime
## File Locking
- Windows locks files aggressively โ test file access before operations:
```powershell
try { [IO.File]::OpenWrite($path).Close(); $true } catch { $false }
```
- Scheduled tasks writing to same file as user โ conflicts. Use unique temp files and atomic rename
## Temp File Hygiene
- `$env:TEMP` fills silently โ scripts should cleanup with `try/finally`:
```powershell
$tmp = New-TemporaryFile
try { ... } finally { Remove-Item $tmp -Force }
```
- Orphaned temp files accumulate across reboots โ unlike Linux /tmp
## Service Account Gotchas
- Services run in different user context โ `$env:USERPROFILE` points to system profile, not user's
- Network access from SYSTEM account uses machine credentials โ may fail where user succeeds
- Mapped drives don't exist for services โ use UNC paths `\\server\share`
Files in this skill
- SKILL.md
- _meta.json
Attribution
Related skills
View all in security โComments
Loading commentsโฆ
Newsletter
Get the weekly list of safe new skills, and the ones we pulled.