Read registry value and reboot and resume
Posted: Mon Sep 11, 2023 11:09 pm
Hi,
To solve issues when installing SQL Server media on Windows 11 systems I want to read a registry value before Pre-requisite SQL Server Media is installed.
If the value is not available or incorrect it should be added to the registry (ONLY when the SQL instance isn't already installed).
The system needs to be rebooted in order to activate the new value (before installing SQL Server).
Background info: https://learn.microsoft.com/en-us/troubleshoot/sql/database-engine/database-file-operations/troubleshoot-os-4kb-disk-sector-size
The code basically looks like the following.
Will it work if I add the section to the "Check SQL Instance"-script (like below)?
Thanks for your help.
To solve issues when installing SQL Server media on Windows 11 systems I want to read a registry value before Pre-requisite SQL Server Media is installed.
If the value is not available or incorrect it should be added to the registry (ONLY when the SQL instance isn't already installed).
The system needs to be rebooted in order to activate the new value (before installing SQL Server).
Background info: https://learn.microsoft.com/en-us/troubleshoot/sql/database-engine/database-file-operations/troubleshoot-os-4kb-disk-sector-size
The code basically looks like the following.
Code: Select all
Set Variable WIZZ_FORCE_SECTORSIZE_WIN11 to
Set x64 - Native 64 bit Windows, AMD64 and EM64T Architectures - installation mode
Comment: Registry uitlezen t.b.v. installatie SQL Server op Windows 11 systemen.
Read Registry Key HKLM\SYSTEM\CurrentControlSet\Services\stornvme\Parameters\Device\ForcedPhysicalSectorSizeInBytes into WIZZ_FORCE_SECTORSIZE_WIN11
if Variable WIZZ_FORCE_SECTORSIZE_WIN11 not Equals * 4095
Comment: Registry waarde toevoegen t.b.v. installatie SQL Server op Windows 11 systemen.
Write Registry Key HKLM\SYSTEM\ControlSet001\Services\stornvme\Parameters\Device\ForcedPhysicalSectorSizeInBytes, * 4095 (permanent)
Reboot Computer and Resume Setup
end
Will it work if I add the section to the "Check SQL Instance"-script (like below)?
Code: Select all
Set Variable ISWINDOWS64BIT to FALSE
Set Variable WIZZ_FORCE_SECTORSIZE_WIN11 to
Get System Setting Windows in 64 bit Mode into ISWINDOWS64BIT
if Variable ISWINDOWS64BIT Equals TRUE
Set x64 - Native 64 bit Windows, AMD64 and EM64T Architectures - installation mode
Check Service State for MSSQL$BALANCEDPLUS2008 (write result into variable MSSQL2022_X64)
if Variable MSSQL2022_X64 Equals NOTINSTALLED
[b] Comment: Registry uitlezen t.b.v. installatie SQL Server op Windows 11 systemen.
Read Registry Key HKLM\SYSTEM\CurrentControlSet\Services\stornvme\Parameters\Device\ForcedPhysicalSectorSizeInBytes into WIZZ_FORCE_SECTORSIZE_WIN11
if Variable WIZZ_FORCE_SECTORSIZE_WIN11 not Equals * 4095
Comment: Registry waarde toevoegen t.b.v. installatie SQL Server op Windows 11 systemen.
Write Registry Key HKLM\SYSTEM\ControlSet001\Services\stornvme\Parameters\Device\ForcedPhysicalSectorSizeInBytes, * 4095 (permanent)
Reboot Computer and Resume Setup
end
[/b] Get System Setting Windows 8 into MSSQL2022_IS8_X64
if Variable MSSQL2022_IS8_X64 Equals FALSE
Set Variable OS_SP to
Get System Setting Windows 2008 R2 into MSSQL2022_IS2008R2_X64
Get System Setting Windows 2008 into MSSQL2022_IS2008_X64
Get System Setting Windows 7 into MSSQL2022_ISSEVEN_X64
if Variable MSSQL2022_IS2008R2_X64 Equals TRUE
Comment: For Win 2008 R2, at least Service Pack 1 is required
Get System Setting Service Pack 1 into OS_SP
if Variable OS_SP Equals FALSE
MessageBox: $TITLE$ Setup, $TITLE$ requires at least Service Pack 1 or later. Please upgrade your operating system and try again.$NEWLINE$$NEWLINE$$TITLE$ Setup cannot continue.
Terminate Installation
end
else
if Variable MSSQL2022_IS2008_X64 Equals TRUE
Comment: For Win 2008, at least Service Pack 2 is required
Get System Setting Service Pack 2 into OS_SP
if Variable OS_SP Equals FALSE
MessageBox: $TITLE$ Setup, $TITLE$ requires at least Service Pack 2 or later. Please upgrade your operating system and try again.$NEWLINE$$NEWLINE$$TITLE$ Setup cannot continue.
Terminate Installation
end
else
if Variable MSSQL2022_ISSEVEN_X64 Equals TRUE
Comment: For Win 7, at least Service Pack 1 is required
Get System Setting Service Pack 1 into OS_SP
if Variable OS_SP Equals FALSE
MessageBox: $TITLE$ Setup, $TITLE$ requires at least Service Pack 1 or later. Please upgrade your operating system and try again.$NEWLINE$$NEWLINE$$TITLE$ Setup cannot continue.
Terminate Installation
end
else
Comment: at least Windows 7 is required
MessageBox: $TITLE$ Setup, $TITLE$ requires at Windows 7 sp1 or later. Please upgrade your operating system and try again.$NEWLINE$$NEWLINE$$TITLE$ Setup cannot continue.
Terminate Installation
end
end
end
end
Set Variable MSSQL2022_X64 to FALSE
Set Variable PREREQ to TRUE
Set Variable PRELIST to $PRELIST$$NEWLINE$Microsoft SQL Server Express 2022 (x64)
else
Set Variable MSSQL2022_X64 to TRUE
end
Set Win32 - Native 32 bit Windows and Windows 32 on Windows 64 (WOW64) - installation mode
else
MessageBox: $TITLE$ Setup, $TITLE$ requires a 64 bit operating system. Please upgrade your operating system and try again.$NEWLINE$$NEWLINE$$TITLE$ Setup cannot continue.
Terminate Installation
end
Thanks for your help.