> ## 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: Rename a Computer
- URL: https://www.filipkonopik.com/powershell-rename-a-computer/
- Published: 2026-07-27T13:16:51.000Z
- Updated: 2026-08-06T05:49:02.000Z
- Author: Filip Konopík
- Tags: System Info

Need to change a machine's hostname - as part of a naming convention cleanup, imaging process, or asset management update? This one-liner renames it directly from the terminal.

Prerequisites:

- Privileges: Run as Administrator
- Module: Built-in, no import needed

Quick Command:

```Powershell
Rename-Computer -NewName "NewPCName" -Restart
```

This requires a restart to take effect, and -Restart triggers it immediately once the rename completes. Save any open work first, and don't run this on a machine you're actively using without planning for the reboot.

📦

****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:

- Rename-Computer changes the machine's hostname - the same value returned by Win32\_ComputerSystem's Name property, covered in the hostname article earlier.
- \-NewName "NewPCName" sets the new hostname - replace this with whatever name you actually want.
- \-Restart forces an immediate restart after the rename, since the new name doesn't fully take effect (especially for network visibility) until the system reboots. Without this parameter, the rename is staged but won't apply until the next manual restart.