> ## Content Index
> Fetch the complete content index at: https://www.filipkonopik.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# PowerShell: Get Computer Hostname
- URL: https://www.filipkonopik.com/powershell-get-computer-hostname/
- Published: 2026-07-21T07:29:41.000Z
- Updated: 2026-08-06T05:31:00.000Z
- Author: Filip Konopík
- Tags: System Info

Need to check a machine's hostname - for identifying which computer you're on, logging, or scripts that run across multiple machines? This one-liner pulls it straight from the system.

Prerequisites:

- Privileges: None
- Module: Built-in, no import needed

Quick Command:

```PowerShell
Get-CimInstance -ClassName Win32_ComputerSystem | Select-Object Name
```

Example Output:

```PowerShell
Name
----
PC-IT-01
```

📦

****Want all of them at once?**  
Get every free one-liner from this blog in a single downloadable bundle organized by category, each with full comment-based help. No more copy-pasting one at a time.

[Get the Complete Bundle for $39](https://gum.co/u/oczvkqdc?ref=filipkonopik.com)

How It Works:

- Get-CimInstance -ClassName Win32\_ComputerSystem queries the computer system class, which holds machine-level info like name, manufacturer, and system type.
- Select-Object Name trims the output down to just the Name property, since Win32\_ComputerSystem also returns a lot more data (like Manufacturer, Model, or TotalPhysicalMemory) that isn't needed for a quick hostname check.