Tip: You can check if a computer is a member of a domain or a workgroup.
1 2 3 4 5 |
# PartOfDomain (boolean Property) (Get-WmiObject -Class Win32_ComputerSystem).PartOfDomain # Workgroup (string Property) (Get-WmiObject -Class Win32_ComputerSystem).Workgroup |
Workgroup
Domain
MSDN:
PartOfDomain property
Win32_ComputerSystem class Class
Pingback: Powershell Tip #62: Concatenate arrays | Powershell Guru
Pingback: Powershell Tip #64: Enable or Disable the Windows Firewall | Powershell Guru
Hi,
Unfortunatelly you have no way of checking if it’s an actual domain or not.
Example (this is a computer in the Workgroup test.local):
PS C:\Users\Administrator> Get-WmiObject -Class Win32_ComputerSystem
Domain : TEST.LOCAL
Manufacturer : Microsoft Corporation
Model : Virtual Machine
Name : WIN-2K8R2-01
PrimaryOwnerName : Windows User
TotalPhysicalMemory : 1073274880
Cheers
Hi Gabriel,
You can use the PartOfDomain boolean property from the Win32_ComputerSystem class.
(Get-WmiObject -Class Win32_ComputerSystem).PartOfDomain
Regards,
Steve