# Write PowerShell commands to silently install or update software

Unattended install or update commands for Windows using winget or Chocolatey, with verification and a fallback when silent install isn't possible.

- Topic: Software Development
- Framework: Few-Shot
- Level: Standard
- Tags: Write, Rewrite & Edit, Fill-in Template
- Source: https://www.thinkwithprompt.com/prompts/write-powershell-commands-to-silently-install-or-update-software

## Prompt

```text
Write PowerShell commands to silently install or update software on Windows.

**Software:** [NAME(S) and edition - e.g. "7-Zip", "Google Chrome Enterprise", "VS Code (system install)"]
**Target machines:** [Windows 10 / 11, x64 or ARM, domain-joined or not]
**Package managers available:** [winget / Chocolatey / none]
**Install scope:** [per-user / all users]
**How it will run:** [manually as admin / Intune / Group Policy / RMM tool / scheduled task]

Approach, in this order of preference:
1. winget: give the command with the exact package ID, --silent, scope, and agreement flags. Mark the package ID [CONFIRM] and show me how to verify it with `winget search` or `winget show`.
2. Chocolatey, if it's not on winget.
3. The vendor's official installer with its documented silent switches (MSI: msiexec /qn /norestart; EXE: vendor-specific). Only use official download sources, and tell me where to confirm the switches in the vendor's documentation.
4. If silent install isn't supported, say so and give the shortest manual steps.

Also give me:
- A version check before and after, and how to update instead of reinstall.
- Exit codes to treat as success (e.g. 0, 3010 for reboot required).
- Logging to a file so failures can be diagnosed.
- A combined script if I listed several apps, which continues past failures and prints a summary.

Do not disable security features, bypass execution policy permanently, or download from unofficial mirrors. Recommend testing on one machine before deploying widely.
```

## What to fill in

- Windows 10 / 11, x64 or ARM, domain-joined or not
- winget / Chocolatey / none
- per-user / all users
- CONFIRM

Free to copy and use. From ThinkWithPrompt (https://www.thinkwithprompt.com/), a library of 2,663 curated AI prompts.
