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.

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: