PowerShell for Windows Admins

Sep 6 2011   11:29AM GMT

Test for domain membership

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

Quick function to determine if a given machine is in a domain or workgroup

function test-domain{             
param (             
 Get-WmiObject -Class Win32_ComputerSystem -ComputerName $computer |            
 select Name, Domain            

Feed the function a computer name or IP address and it will return the name and domain. If the computer is in the domain we get the full domain name – if its in a workgroup we get the workgroup name (WORKGROUP by default)

 Comment on this Post

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when other members comment.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

Share this item with your network: