Page 1 of 1 1
Topic Options
#203549 - 2011-11-08 11:15 PM Bug in @producttype Win2K8
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4672
Loc: The Netherlands
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
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#203558 - 2011-11-09 11:00 PM Re: Bug in @producttype Win2K8 [Re: Mart]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4545
Loc: USA
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

Top
#204021 - 2012-01-06 08:53 PM Re: Bug in @producttype Win2K8 [Re: Allen]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
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
_________________________
Actually I am a Rocket Scientist! \:D

Top
#204025 - 2012-01-07 12:39 AM Re: Bug in @producttype Win2K8 [Re: Glenn Barnas]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4545
Loc: USA
I wonder if the trailing space on the 2008 results is on the domain controllers and it's somehow dropping "Domain Controller" inadvertently.
Top
#204026 - 2012-01-07 01:09 AM Re: Bug in @producttype Win2K8 [Re: Allen]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11623
Loc: CA
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.
Top
#204090 - 2012-01-19 06:43 PM Re: Bug in @producttype Win2K8 [Re: NTDOC]
Lee Wilmott Offline
Starting to like KiXtart

Registered: 2002-09-17
Posts: 106
Loc: Bristol, UK
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

Top
#204091 - 2012-01-19 06:44 PM Re: Bug in @producttype Win2K8 [Re: Lee Wilmott]
Lee Wilmott Offline
Starting to like KiXtart

Registered: 2002-09-17
Posts: 106
Loc: Bristol, UK
PS...while it may seem minor, I do agree that if a trailing space exists, it ought to be removed.
Top
#205319 - 2012-05-24 04:28 PM Re: Bug in @producttype Win2K8 [Re: Lee Wilmott]
Ruud van Velsen Moderator Offline
Developer
*****

Registered: 1999-05-06
Posts: 391
Loc: Amsterdam, The Netherlands
Good point on the trailing space, and an easy fix.

Ruud

Top
#205563 - 2012-08-22 08:08 PM Re: Bug in @producttype Win2K8 [Re: Ruud van Velsen]
Ruud van Velsen Moderator Offline
Developer
*****

Registered: 1999-05-06
Posts: 391
Loc: Amsterdam, The Netherlands
The trailing spaces are addressed in 4.63, in test soon...

Ruud

Top
#205588 - 2012-08-26 05:11 PM Re: Bug in @producttype Win2K8 [Re: Ruud van Velsen]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4545
Loc: USA
Ruud, any ideas on why it fails to detect domain controllers?
Top
Page 1 of 1 1


Moderator:  ShaneEP, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 507 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.044 seconds in which 0.018 seconds were spent on a total of 13 queries. Zlib compression enabled.