> ## 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 Domain or Workgroup
- URL: https://www.filipkonopik.com/powershell-get-domain-or-workgroup/
- Published: 2026-07-27T13:19:52.000Z
- Updated: 2026-08-06T05:49:10.000Z
- Author: Filip Konopík
- Tags: System Info

Need to check whether a machine is joined to a domain or just a workgroup - for network configuration audits or troubleshooting authentication issues? 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 Domain, PartOfDomain, Workgroup
```

Example Output:

```powershell
Domain       PartOfDomain Workgroup
------       ------------ ---------
corp.local           True
```

📦

****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 same class used earlier for hostname lookups - it also holds domain/workgroup membership info.
- Domain shows the domain name if the machine is domain-joined, or the workgroup name if it isn't.
- PartOfDomain gives a direct True/False answer to whether the machine is actually joined to a domain (as opposed to just being in a workgroup with the same displayed name).
- Workgroup is populated only when the machine is not domain-joined - on a domain-joined machine, this typically shows blank, since Domain already covers that case.