PowerShell for Windows Admins

Oct 25 2010   12:16PM GMT

Computer Roles

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

 

Do your systems know what they are supposed to be doing?

This quick test ensure that the machines know which domain they are in and what they are configured to do.

001
002
003
004
005
006
007
008
009
010
011
012
013
014
$domrole = DATA {
ConvertFrom-StringData -StringData 
@’
0 = Standalone Workstation
1 = Member Workstation
2 = Standalone Server
3 = Member Server
4 = Backup Domain Controller
5 = Primary Domain Controller
‘@

}
Get-WmiObject -Class Win32_ComputerSystem | 
Format-List Name, Domain,
@{Name="DomainRole"; Expression={$domrole["$($_.DomainRole)"]}
}

No surprises in this one.  Read the name, domain and role from Win32_ComputerSystem. Convert the role using  a here string to hold the data and convert it to a hash table we can look up.

 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: