# Powershell

> PowerShell scripting for Windows automation, cmdlets, and administration. Use for .ps1 files.

- Skill: `g1joshi/powershell` (Agent Skill)
- Install (CLI): `npx skillmds@latest add g1joshi/powershell`
- Raw SKILL.md: https://api.skillmd.com/api/skills/g1joshi/powershell/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: G1Joshi (https://skillmd.com/u/g1joshi)
- Updated: 2026-09-10
- Page: https://skillmd.com/skills/g1joshi/powershell

---


# PowerShell

A task-based command-line shell and scripting language built on .NET.

## When to Use

- Windows system administration
- Azure management
- Object-oriented scripting
- Cross-platform automation (PowerShell Core)

## Quick Start

```powershell
$name = "World"
Write-Host "Hello, $name!"

$processes = Get-Process | Where-Object { $_.CPU -gt 10 }
foreach ($p in $processes) {
    Write-Output $p.Name
}
```

## Core Concepts

### Cmdlets

Lightweight commands used in the PowerShell environment (Verb-Noun structure).

- `Get-Process`
- `New-Item`
- `Set-Location`

### Objects

PowerShell pipes **Objects**, not text.

```powershell
Get-Service | Select-Object -Property Name, Status
```

### Pipeline

Passes objects from one cmdlet to the next.

## Best Practices

**Do**:

- Use the Verb-Noun naming convention for functions
- Use `Try/Catch` for error handling
- Use `[CmdletBinding()]` for advanced functions
- Output objects, not text (`Write-Output` over `Write-Host`)

**Don't**:

- Parse text output like in Bash (use object properties)
- Use aliases in scripts (readability)

## References

- [Microsoft PowerShell Docs](https://learn.microsoft.com/en-us/powershell/)

