Hi there,<br><br>I often get into a situation where I need to know, inside a package, which role the local computer has. For example I have a package which deploys a backup software. For this software to work it is necesssary to add a pre-defined user-account to the group of local administrators. This, of cause, would fail on a domain controller as this machine does not have 'local' groups, so I need to skip these steps on domain controllers.<br>
At the moment this is done by adding hostname checks, but these checks will fail if there is a computer not named after out naming-convention. And this is, however, just _one_ example!<br><br>My suggestion is to add a new check to wpkg. This could be something like:<br>
<br><check type="host" condition="role" value="domaincontroller" /><br><check type="host" condition="role" value="workstation,server" /><br><br>or similar.<br>
<br>I have found some VB code which, with slight modifications, could be used:<br><br>Function DomainRole(sNode)<br> Set oWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & sNode & "\root\cimv2")<br>
Set colComputer = oWMI.ExecQuery("Select DomainRole from Win32_ComputerSystem")<br> For Each oComputer in colComputer<br> iDR = oComputer.DomainRole<br> Next<br><br> Select Case iDR<br> Case 0<br>
DomainRole = "Standalone Workstation"<br> Case 1<br> DomainRole = "Member Workstation"<br> Case 2<br> DomainRole = "Standalone Server"<br> Case 3<br>
DomainRole = "Member Server"<br> Case 4<br> DomainRole = "Backup Domain Controller"<br> Case 5<br> DomainRole = "Primary Domain Controller"<br>
Case Else<br> DomainRole = "Unknown"<br> End Select<br><br>End Function<br><br>Regards,<br>Malte<br>