#-----
# ParameterListe.ps1
#-----
$rootSetupFiles=$rootFolderSetup + "\SetupFiles"
$rootPSFiles=$rootFolderSetup + "\SetupPowershell"
$rootServerCoreInstallDir=$rootFolderSetup + "\ServerCoreInstall"
$vmSetupFileDir="C:\SetupFiles"
$vmSetupFileDirDocker="C:/SetupFiles/"
$vmPSSkriptDir=$vmSetupFileDir + "\PowershellSkripte"
$vmPSModuleDir=$vmSetupFileDir + "\PowershellModules"
$vmPSModuleNuGet=$vmPSModuleDir + "\nuget"
$vmPSModuleSQLServer=$vmPSModuleDir + "\SqlServer"
$vmPSModulePSPKI=$vmPSModuleDir + "\pspki"
$vmNugetPath="C:\Program Files\PackageManagement\ProviderAssemblies\nuget\2.8.5.208"
$vmPSPKIModulesPath="c:\Program Files\WindowsPowerShell\Modules\pspki\3.7.2"
$vmSQLServerModulesPath="C:\Program Files\WindowsPowerShell\Modules\SqlServer"
$CommSetupDir=$vmSetupFileDir + "\CommAppSetup\*"
$certSetupDir=$vmSetupFileDir + "\Certificate\*"
$NET352016SetupDir=$vmSetupFileDir + "\NET35Offline\2016\*"
$NET352019SetupDir=$vmSetupFileDir + "\NET35Offline\2019\*"
$NET352022SetupDir=$vmSetupFileDir + "\NET35Offline\2022\*"
$NET3520H2SetupDir=$vmSetupFileDir + "\NET35Offline\20H2\*"
$NET35Dir="c:\sources\sxs"
$vmPSSkriptSQLServerSetup=$vmPSSkriptDir + "\SQLServer_Setup.ps1"
$vmPSSkriptIISSetup=$vmPSSkriptDir + "\IISServer_Setup.ps1"
$vmPSSkriptIISImportCert=$vmPSSkriptDir + "\IISServer_ImportCert.ps1"
$vmPSSkriptACLsetup=$vmPSSkriptDir + "\Set_ACL.ps1"
$vmPSSkriptCommsetup=$vmPSSkriptDir + "\Comm_Setup.ps1"
$SqlSetupExePath=$vmSetupFileDir + "\SQLExpressSetup\SQLEXPRADV_x64_ENU\Setup.exe"
$SQLSkript01_Platzhalter="C:\ProjektName\"
$SQLDBSetup_Dir=$vmSetupFileDir + "\ProjektNameDBSetup"
$SQLDBSetup_Skript01=$SQLDBSetup_Dir + "\01_ProjektNameCreateDatabase.sql"
$SQLDBSetup_Skript02=$SQLDBSetup_Dir + "\02_ProjektNameCreateSQLUserAndSchema.sql"
$SQLDBSetup_Skript03=$SQLDBSetup_Dir + "\03_ProjektNameCreateTables.sql"
$SQLDBSetup_Skript04=$SQLDBSetup_Dir + "\04_ProjektNameInsertDefaultData.sql"
$SQLDBSetup_Skript05=$SQLDBSetup_Dir + "\05_ProjektNameCreateSQLUser.sql"
$PHPDir="C:\Program Files\php8"
$EDITOR=0
$Notepad=$vmSetupFileDir + "\ToolsSetup\notepad64.msi"
$BROWSERTYPE=0
$certTYPE=0
$Chrome=$vmSetupFileDir + "\ToolsSetup\googlechromestandaloneenterprise64.msi"
$Edge=$vmSetupFileDir + "\ToolsSetup\MicrosoftEdgeEnterpriseX64.msi"
$Firefox=$vmSetupFileDir + "\ToolsSetup\Firefox64.msi"
$IMAGETYPE=2019
$InetPubRoot="C:\Inetpub"
$InetPubLog=$InetPubRoot + "\log"
$InetPubWWWRoot=$InetPubRoot + "\wwwroot"
$InetPubData=$InetPubRoot + "\daten"
$InetPubSessions=$InetPubRoot + "\php_sessions"
$InetPubUploads=$InetPubRoot + "\uploads"
$NewInetPubRoot="D:\Inetpub"
$NewInetPubLog=$NewInetPubRoot + "\log"
$NewInetPubWWWRoot=$NewInetPubRoot + "\wwwroot"
$NewInetPubData=$NewInetPubRoot + "\daten"
$NewInetPubSessions=$NewInetPubRoot + "\php_sessions"
$NewInetPubUploads=$NewInetPubRoot + "\uploads"
$PHPConfigTemplate=$vmSetupFileDir + "\PHPConfigVorlagen\config.php"
$PHPiniTemplate=$vmSetupFileDir + "\PHPConfigVorlagen\php.ini"
$PHPConfigDir=$InetPubWWWRoot + "\config\config.php"
$NewPHPConfigDir=$NewInetPubWWWRoot + "\config\config.php"
$PHPCGI=$PHPDir + "\php-cgi.exe"
$PHPSetupPath=$vmSetupFileDir + "\PHPSetup\php\*"
$PHPExtPath=$PHPDir + "\ext"
$PHPiniTarget=$PHPDir + "\php.ini"
$ProjektNameSetupFiles=$vmSetupFileDir + "\ProjektNameAppSetup"
$VCppRuntimes=$vmSetupFileDir + "\VCppRuntimeSetup\VisualCppRedist_AIO_x86_x64.exe"
$URLRewrite=$vmSetupFileDir + "\URLRewriteSetup\rewrite_amd64_en-US.msi"
$OPENJDK=$vmSetupFileDir + "\OpenJDK\amazon-corretto-11.0.14.10.1-windows-x64.msi"
$ODBC=$vmSetupFileDir + "\SQLODBCSetup\msodbcsql.msi"
$DockerFileDir=$rootFolderSetup + "\dockerfile"
$DockerFiles=$DockerFileDir + "\dockerfile"
$DockerSetupFiles=$DockerFileDir + "\SetupFiles"
$certDir="c:\Cert"
$certMyStore= "Cert:\LocalMachine\My"
$certCAStore= "Cert:\LocalMachine\CA"
$certRootStore= "Cert:\LocalMachine\Root"
$certFriendlyName = "ProjektName SelfSignedCert (c) 2022"
$certPfxPwd= "!ProjektName@PassW0rd_2022"
$CommDir="C:\instComm"
$dockerLabelMaintainer="ProjektName@mail.com"
$DockerImageName_SQL="ProjektName_sql_image"
$DockerHostName_SQL="srv_sql"
$DockerImageName_IIS="ProjektName_iis_image"
$DockerHostName_IIS="srv_iis"
$DockerImageName="ProjektName_complete_image"
$DockerHostName="srv_ProjektName"
$DockerNetwork="winl2bridge"
$tempDir = "c:\temp\"
$Destination = "C:\Container"
$DockerDir = $Destination + "\docker"
$SQLDBPathDir="C:\ProjektNameDB\"
$SQLDBPathDir_Backup=$SQLDBPathDir + "\Databases\Backup"
$SQLDBPathDir_Data=$SQLDBPathDir + "\Databases\Data"
$SQLDBPathDir_Log=$SQLDBPathDir + "\Databases\Log"
$SQLDBName="ProjektNameDB"
$SqlSetup_SaUser="sa"
$SqlSetup_SaPass="!ProjektName@PassW0rd_2022"
$SqlSetup_InstanceName="SQLEXPRESS"
$SqlSetup_Server="localhost\SQLEXPRESS"
$SQLServerIP="127.0.0.1"
$SQLServerHostName=$DockerHostName
$IISServerIP="127.0.0.1"
$IIS_ServerHostName=$DockerHostName
$global:started = $FALSE
$global:startingStep = $Step
$global:restartKey = "Restart-And-Resume"
$global:RegRunKey ="HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run"
$global:powershell = (Join-Path $env:windir "system32\WindowsPowerShell\v1.0\powershell.exe")
#-----
# Collection of Utility Functions for Automatically Restart Script after Restart Computer
#-----
Function Should-Run-Step([string] $prospectStep)
{
if ($global:startingStep -eq $prospectStep -or $global:started) {$global:started = $TRUE}
return $global:started
}
Function Wait-For-Keypress([string] $message, [bool] $shouldExit=$FALSE)
{
Write-Host "$message" -foregroundcolor yellow
$key = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
if ($shouldExit) {exit}
}
Function Test-Key([string] $path, [string] $key)
{
return ((Test-Path $path) -and ((Get-Key $path $key) -ne $null))
}
Function Remove-Key([string] $path, [string] $key)
{
Remove-ItemProperty -path $path -name $key
}
Function Set-Key([string] $path, [string] $key, [string] $value)
{
Set-ItemProperty -path $path -name $key -value $value
}
Function Get-Key([string] $path, [string] $key)
{
return (Get-ItemProperty $path).$key
}
Function Restart-And-Run([string] $key, [string] $run)
{
Set-Key $global:RegRunKey $key $run
Restart-Computer
exit
}
Function Clear-Any-Restart([string] $key=$global:restartKey)
{
if (Test-Key $global:RegRunKey $key) {Remove-Key $global:RegRunKey $key}
}
Function Restart-And-Resume([string] $script, [string] $step)
{
Restart-And-Run $global:restartKey "$global:powershell $script -Step $step"
}
Function Write-Log
{
[CmdletBinding()]
param(
[Parameter()]
[ValidateNotNullOrEmpty()]
[string]$Message,
[Parameter()]
[ValidateNotNullOrEmpty()]
[ValidateSet('Information','Warning','Error')]
[string]$Severity = 'Information'
)
[pscustomobject]@{
Time = (Get-Date -f g)
Message = $Message
Severity = $Severity
} | Export-Csv -Path "$env:Temp\install.csv" -Append -NoTypeInformation
}
#----- EOF