Hello,
I understand this script, only one thing I am interested in and not fully understood, that is "domainRole" property. How can I examine this property if I would like to know the meanings of the number, in this case, if I run this script on my laptop it says "Member workstation" that is true because my laptop is WIN7 and entered Domain. Well, I realized that "domainRole"' property has numbers and meaning.. but How can I see both of them….
The script:
##################################################
$strComputer = Read-Host "Enter Computer Name"
$objWMI = Get-WmiObject -Class win32_ComputerSystem -namespace "rootCIMV2" `
-computername $strComputer
Write-Host "Computer: $strComputer is a:"
switch ($objWMI.domainRole)
{
0 {Write-Host "Stand alone workstation"}
1 {Write-Host "Member workstation"}
2 {Write-Host "Stand alone server"}
3 {Write-Host "Member server"}
4 {Write-Host "Back-up domain controller"}
5 {Write-Host "Primary domain controller"}
default {Write-Host "The role can not be determined"}
}
##################################################
Thanks in advance,
R.