Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
[windows] add SQL LocalDB warmup
"sqllocaldb create MSSQLLocalDB" ran during image generation and
created DB is moved to permanent location
  • Loading branch information
ilia-shipitsin committed Oct 2, 2023
commit 56476a3956cb0610b43862b7f986414c12ec98d2
17 changes: 17 additions & 0 deletions images/win/scripts/Installers/Warmup-User.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,22 @@ if (-not(Test-Path -Path $registryKeyPath)) {
New-ItemProperty -Path $RegistryKeyPath -Name CacheType -PropertyType DWORD -Value 0
reg.exe copy HKCU\Software\TortoiseSVN HKLM\DEFAULT\Software\TortoiseSVN /s


# warmup SQL LocalDB
# https://github.com/actions/runner-images/issues/8164

sqllocaldb create MSSQLLocalDB

$localDBInstance = Get-ChildItem -Path 'HKCU:\Software\Microsoft\Microsoft SQL Server\UserInstances'
$instanceName = ($localDBInstance.Name).Split('\').where({ $true },'Last')
$instancePath = 'HKCU:\Software\Microsoft\Microsoft SQL Server\UserInstances\' + $instanceName
$dataDirectory = (Get-ItemProperty -Path $instancePath -Name 'DataDirectory').DataDirectory
$localDBPath = 'C:\LocalDB'
New-Item -ItemType 'Directory' -Path $localDBPath
Move-Item -Path "$dataDirectory\*" -Destination $localDBPath
Set-ItemProperty -Path $instancePath -Name 'DataDirectory' -Value $localDBPath

reg.exe copy 'HKCU\Software\Microsoft\Microsoft SQL Server' 'HKLM\DEFAULT\Software\Microsoft\Microsoft SQL Server' /s

reg.exe unload HKLM\DEFAULT
Write-Host "Warmup-User.ps1 - completed"