powershell-5.1-expert
Expert in legacy Windows PowerShell 5.1. Specializes in WMI, ADSI, COM automation, and maintaining backward compatibility with Windows Server environments. Use for Windows-specific automation on legacy systems. Triggers include "PowerShell 5.1", "Windows PowerShell", "WMI", "ADSI", "COM object", "legacy PowerShell".
How do I install this agent skill?
npx skills add https://github.com/404kidwiz/claude-supercode-skills --skill powershell-51-expertIs this agent skill safe to install?
- Gen Agent Trust Hubfail
This skill is designed for legacy Windows PowerShell 5.1 administration, which inherently involves high-privilege operations. However, it contains a critical security flaw: a hardcoded password ('TempP@ss123!') in the 'manage_legacy_ad.ps1' script for creating new Active Directory users. Additionally, the TypeScript wrapper ('legacy_wrapper.ts') allows for arbitrary PowerShell command execution, and several PowerShell scripts are vulnerable to injection attacks (WQL, LDAP, or arbitrary script execution via DSC configuration paths) if user-supplied inputs are not properly sanitized. This combination poses a severe risk for credential compromise and system takeover.
- Socketpass
No alerts
- Snykwarn
Risk: MEDIUM · No issues
- Runlayerwarn
8/8 files flagged
What does this agent skill do?
PowerShell 5.1 Expert
Purpose
Provides expertise in Windows PowerShell 5.1 for legacy Windows environments. Specializes in WMI queries, ADSI operations, COM automation, and maintaining scripts compatible with older Windows Server systems.
When to Use
- Scripting for Windows Server 2012/2016/2019
- Working with WMI for system management
- Active Directory operations via ADSI
- COM automation (Office, legacy apps)
- Maintaining backward compatibility
- DSC (Desired State Configuration)
- Windows-specific automation
- Legacy script maintenance
Quick Start
Invoke this skill when:
- Working with Windows PowerShell 5.1 specifically
- Using WMI for system queries
- Automating with ADSI or COM objects
- Maintaining legacy PowerShell scripts
- DSC configuration management
Do NOT invoke when:
- Cross-platform PowerShell → use
/powershell-7-expert - GUI/TUI development → use
/powershell-ui-architect - Security hardening → use
/powershell-security-hardening - Module architecture → use
/powershell-module-architect
Decision Framework
PowerShell Version Context?
├── Must run on older Windows
│ └── Use 5.1 with WMI/ADSI
├── Cross-platform needed
│ └── Use PowerShell 7+ instead
├── AD Management
│ ├── Simple → ADSI
│ └── Complex → AD Module
└── System Info
├── Legacy → WMI
└── Modern → CIM (also works in 5.1)
Core Workflows
1. WMI System Query
- Identify WMI class (Win32_*)
- Construct WMI query
- Use Get-WmiObject or Get-CimInstance
- Filter results appropriately
- Format output
- Handle errors for remote systems
2. ADSI Operations
- Create DirectoryEntry object
- Navigate LDAP path
- Query or modify attributes
- Commit changes if modifying
- Handle authentication
- Clean up resources
3. COM Automation
- Create COM object with New-Object -ComObject
- Access object model
- Perform operations
- Handle COM errors
- Release COM objects properly
- Clean up with [System.Runtime.InteropServices.Marshal]
Best Practices
- Use CIM cmdlets over WMI when possible (better remoting)
- Always include error handling for remote operations
- Release COM objects explicitly to prevent memory leaks
- Test on target Windows versions
- Document required PowerShell modules
- Use approved verbs for functions
Anti-Patterns
| Anti-Pattern | Problem | Correct Approach |
|---|---|---|
| Not releasing COM | Memory leaks | Explicit cleanup |
| WMI over slow networks | Performance issues | Use CIM with sessions |
| No error handling | Silent failures | Try/Catch with logging |
| Hardcoded paths | Portability issues | Use environment variables |
| Write-Host for output | Can't capture | Write-Output or return |
How can the creator link this skill?
Add the canonical catalog link to the repository README so users can inspect current installs and available audits. The publishing guide covers the complete discovery path.
<a href="https://skillzs.dev/skills/404kidwiz/claude-supercode-skills/powershell-5.1-expert">View powershell-5.1-expert on skillZs</a>