-
Notifications
You must be signed in to change notification settings - Fork 3
/
PrepareWebServer.ps1
31 lines (24 loc) · 1.03 KB
/
PrepareWebServer.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
param(
[Parameter(Mandatory)]
[string]$SqlServerIso,
[Parameter(Mandatory)]
[string]$WindowsServerCoreIso,
[Parameter(Mandatory)]
[string]$Destination
)
$ErrorActionPreference = 'Stop'
$sqlMount = Mount-DiskImage -ImagePath $SqlServerIso -PassThru
$serverCoreMount = Mount-DiskImage -ImagePath $WindowsServerCoreIso -PassThru
try
{
$sqlRoot = (Get-DiskImage -ImagePath $sqlMount.ImagePath | Get-Volume).DriveLetter + ":\"
$serverCoreRoot = (Get-DiskImage -ImagePath $serverCoreMount.ImagePath | Get-Volume).DriveLetter + ":\"
Copy-Item -Path (Join-Path $serverCoreRoot 'sources\sxs\microsoft-windows-netfx3-ondemand-package.cab') -Destination $Destination -Force
Add-Type -assembly "system.io.compression.filesystem"
[System.IO.Compression.ZipFile]::CreateFromDirectory($sqlRoot, (Join-Path $Destination 'SqlServerInstaller.zip'), 'NoCompression', $true)
}
finally
{
Dismount-DiskImage -ImagePath $SqlServerIso
Dismount-DiskImage -ImagePath $WindowsServerCoreIso
}