Slight issue with install-certificationauthority, errors on 2008 R2 Server Core (just need to tweak one ProductType check)
-
Monday, February 20, 2012 6:02 AM
A slight problem with the install-certificationauthority script; OOTB on 2008 R2 Server Core it errors.
On 2008 R2 Server Core, a value of 2 is returned by Get-WmiObject Win32_OperatingSystem -Property Version, ProductType. The script errors if the ProductType doesn't equal 3.
#region OS and existing CA checking
# check if script running on Windows Server 2008 or Windows Server 2008 R2
$OS = Get-WmiObject Win32_OperatingSystem -Property Version, ProductType
if ([int][string]$OS.Version[0] -lt 6) {
Write-Error -Category NotImplemented -ErrorId "NotSupportedException" `
-ErrorAction Stop -Message "Windows XP, Windows Server 2003 and Windows Server 2003 R2 are not supported!"
} elseif ($OS.ProductType -ne 3) {
Write-Error -Category NotImplemented -ErrorId "NotSupportedException" `
-ErrorAction Stop -Message "Client operating systems are not supported!"
}
A quick change to 2 allowed it to install successfully and it's working just fine.
http://gallery.technet.microsoft.com/scriptcenter/Setup-Certification-bd2aff3e
All Replies
-
Monday, February 20, 2012 6:36 AM
A slight problem with the install-certificationauthority script; OOTB on 2008 R2 Server Core it errors.
On 2008 R2 Server Core, a value of 2 is returned by Get-WmiObject Win32_OperatingSystem -Property Version, ProductType. The script errors if the ProductType doesn't equal 3.
#region OS and existing CA checking
# check if script running on Windows Server 2008 or Windows Server 2008 R2
$OS = Get-WmiObject Win32_OperatingSystem -Property Version, ProductType
if ([int][string]$OS.Version[0] -lt 6) {
Write-Error -Category NotImplemented -ErrorId "NotSupportedException" `
-ErrorAction Stop -Message "Windows XP, Windows Server 2003 and Windows Server 2003 R2 are not supported!"
} elseif ($OS.ProductType -ne 3) {
Write-Error -Category NotImplemented -ErrorId "NotSupportedException" `
-ErrorAction Stop -Message "Client operating systems are not supported!"
}
A quick change to 2 allowed it to install successfully and it's working just fine.
http://gallery.technet.microsoft.com/scriptcenter/Setup-Certification-bd2aff3e
You should really post this in the Q&A sextion of the gallery for this script as it does people very little good posted as a comment here.
Those looking at the scriptin the gallery are likely to read the Q&A but they will not likely look here for issues.
¯\_(ツ)_/¯

