Mart
(KiX Supporter)
2011-11-08 11:15 PM
Bug in @producttype Win2K8

Found a possible bug in @producttype.

When using it with kix 4.62 on a Win2K8 x86 and a Win2K8 R2 x64 server it returns an extra space at the end. I did not test on any other flavors of Win2K8 because I do not have them available. Sure a simple trim() would fix this but it should returns correct data imho. Anyone who can verify this?

 Code:
Break on

? @KIX
? @PRODUCTTYPE

Sleep 10


AllenAdministrator
(KiX Supporter)
2011-11-09 11:00 PM
Re: Bug in @producttype Win2K8

Confirmed... as well as a few other problems. All tested below were x64.

@producttype=
Windows Server 2008 R2 - has trailing space.
Windows Server 2008 - has trailing space.
Windows Small Business Server 2011 Standard - returns Windows Server 2008 R2 Small Business Edition


Glenn BarnasAdministrator
(KiX Supporter)
2012-01-06 08:53 PM
Re: Bug in @producttype Win2K8

Maybe not a bug, but a loss of functionality now exists in the @PRODUCTTYPE macro for Windows 2008 platforms.

In all prior versions of the Windows OS, the PRODUCTTYPE macro differentiated between Servers and Domain Controllers. That allowed something like
 Code:
If Instr(@PRODUCTTYPE, 'Server') Or Instr(@PRODUCTTYPE, 'Controller')
  $IsServer = 1
  If Instr(@PRODUCTTYPE, 'Controller')
    $IsDC = 1
  EndIf
EndIf
to set flags for Server and DC roles.

On Windows 2008, the Domain Controller is no longer listed as a separate product type. All DCs and servers are now simply listed as "Server" (yes, there are several classes of "Windows Server 2008...", but none list "Domain Controller".

There are WMI methods to determine DC roles, but it's now extra code. It would be nice to have this functionality extended to the Windows 2008 descriptions.

Alternately, a DOMAINROLE macro that returned the same values as the WMI DomainRole values would be a nice addition:
Value Hex value DomainRole
0 0x0 Standalone Workstation
1 0x1 Member Workstation
2 0c2 Standalone Server
3 0x3 Member Server
4 0x4 Backup Domain Controller
5 0x5 Primary Domain Controller

OK - I'm done whining... ;\)

Glenn


AllenAdministrator
(KiX Supporter)
2012-01-07 12:39 AM
Re: Bug in @producttype Win2K8

I wonder if the trailing space on the 2008 results is on the domain controllers and it's somehow dropping "Domain Controller" inadvertently.

NTDOCAdministrator
(KiX Master)
2012-01-07 01:09 AM
Re: Bug in @producttype Win2K8

Probably just some new programmers and managers at the wheel when they built 2008. They we not around when the old stuff was written and didn't realize it.

Lee Wilmott
(Starting to like KiXtart)
2012-01-19 06:43 PM
Re: Bug in @producttype Win2K8

I made the same comment to Ruud a year or two ago; saying that scripts could no longer identify a Domain Controller. He accepted that fact.

In light of this, I implemented the following script...

 Code:
Function IsDC()
	
	Dim $objWMIService, $colItems, $objItem
	Dim $Counter
	
	;Assume it is not a Domain Controller
	$IsDC = 0
	
	Select
	Case InStr(@PRODUCTTYPE, "Windows Server 2008") <> 0

		$objWMIService = GetObject( "winmgmts://./root/CIMV2" )
		$colItems      = $objWMIService.ExecQuery( "SELECT * FROM Win32_ServerFeature where ID='10'", "WQL", 48 )
		
		$Counter = 0
		For Each $objItem In $colItems
			$Counter = $Counter + 1
		Next
		
		If $Counter <> 0
			$IsDC = 1
		EndIf
		
	Case 1
		If InStr(@PRODUCTTYPE, "Domain Controller") <> 0
			$IsDC = 1
		EndIf
	EndSelect
	
EndFunction

In all honesty, I believe this script can be slimmed down a little, but it works!

It's also not too clever in that a new operating system may require this function to be updated...but you get my drift.

Lee


Lee Wilmott
(Starting to like KiXtart)
2012-01-19 06:44 PM
Re: Bug in @producttype Win2K8

PS...while it may seem minor, I do agree that if a trailing space exists, it ought to be removed.

Ruud van Velsen
(Hey THIS is FUN)
2012-05-24 04:28 PM
Re: Bug in @producttype Win2K8

Good point on the trailing space, and an easy fix.

Ruud


Ruud van Velsen
(Hey THIS is FUN)
2012-08-22 08:08 PM
Re: Bug in @producttype Win2K8

The trailing spaces are addressed in 4.63, in test soon...

Ruud


AllenAdministrator
(KiX Supporter)
2012-08-26 05:11 PM
Re: Bug in @producttype Win2K8

Ruud, any ideas on why it fails to detect domain controllers?