184 lines
3.3 KiB
PowerShell
Executable File
184 lines
3.3 KiB
PowerShell
Executable File
############################################################
|
||
# Transcript
|
||
#
|
||
# PART 8.1 – Enterprise Transcript Logging
|
||
############################################################
|
||
|
||
$TranscriptFile = Join-Path `
|
||
$LogDir `
|
||
"PowerShell_Transcript.log"
|
||
|
||
############################################################
|
||
# Start Transcript
|
||
############################################################
|
||
|
||
function Start-TranscriptLogging {
|
||
|
||
Write-Log "Starte PowerShell Transcript"
|
||
|
||
try {
|
||
|
||
if(Test-Path $TranscriptFile)
|
||
{
|
||
Remove-Item `
|
||
$TranscriptFile `
|
||
-Force
|
||
}
|
||
|
||
Start-Transcript `
|
||
-Path $TranscriptFile `
|
||
-Append `
|
||
-ErrorAction Stop
|
||
|
||
Write-Log "Transcript gestartet"
|
||
|
||
}
|
||
catch {
|
||
|
||
Write-Log "Transcript konnte nicht gestartet werden."
|
||
|
||
}
|
||
|
||
}
|
||
############################################################
|
||
# Stop Transcript
|
||
############################################################
|
||
|
||
function Stop-TranscriptLogging {
|
||
|
||
Write-Log "Beende Transcript"
|
||
|
||
try {
|
||
|
||
Stop-Transcript | Out-Null
|
||
|
||
}
|
||
catch {
|
||
|
||
}
|
||
|
||
}
|
||
############################################################
|
||
# JSON laden
|
||
############################################################
|
||
|
||
function Import-Configuration {
|
||
|
||
param(
|
||
|
||
[string]$ConfigurationFile
|
||
|
||
)
|
||
|
||
Write-Log "Lade Konfiguration"
|
||
|
||
if(!(Test-Path $ConfigurationFile))
|
||
{
|
||
|
||
Stop-Installation `
|
||
"Konfigurationsdatei nicht gefunden."
|
||
|
||
}
|
||
|
||
try
|
||
{
|
||
|
||
$Script:Config =
|
||
Get-Content `
|
||
$ConfigurationFile `
|
||
-Raw |
|
||
ConvertFrom-Json
|
||
|
||
}
|
||
|
||
catch
|
||
{
|
||
|
||
Stop-Installation `
|
||
"JSON konnte nicht gelesen werden."
|
||
|
||
}
|
||
|
||
Write-Log "Konfiguration geladen"
|
||
|
||
}
|
||
############################################################
|
||
# Werte übernehmen
|
||
############################################################
|
||
|
||
function Initialize-Configuration {
|
||
|
||
Write-Log "Übernehme Konfiguration"
|
||
|
||
$DVDSource =
|
||
$Config.General.DVDSource
|
||
|
||
$NetworkSource =
|
||
$Config.General.NetworkSource
|
||
|
||
$SQLInstanceName =
|
||
$Config.SQL.Instance
|
||
|
||
$DatabaseName =
|
||
$Config.SQL.Database
|
||
|
||
$SQLAuthentication =
|
||
$Config.SQL.Authentication
|
||
|
||
$InstallPath =
|
||
$Config.Paths.InstallPath
|
||
|
||
$CatalogPath =
|
||
$Config.Paths.CatalogPath
|
||
|
||
$IRCachePath =
|
||
$Config.Paths.IRCache
|
||
|
||
$GuestCatalogPort =
|
||
$Config.Ports.Catalog
|
||
|
||
$VeeamServicePort =
|
||
$Config.Ports.Service
|
||
|
||
$SecureConnectionPort =
|
||
$Config.Ports.Secure
|
||
|
||
$RestServicePort =
|
||
$Config.Ports.REST
|
||
|
||
}
|
||
############################################################
|
||
# Plugins
|
||
############################################################
|
||
|
||
$Plugins = @{
|
||
|
||
AHV_INSTALL =
|
||
[int]$Config.Plugins.AHV
|
||
|
||
KVM_INSTALL =
|
||
[int]$Config.Plugins.KVM
|
||
|
||
PVE_INSTALL =
|
||
[int]$Config.Plugins.PVE
|
||
|
||
SCP_INSTALL =
|
||
[int]$Config.Plugins.SCP
|
||
|
||
AWS_INSTALL =
|
||
[int]$Config.Plugins.AWS
|
||
|
||
AZURE_INSTALL =
|
||
[int]$Config.Plugins.Azure
|
||
|
||
GCP_INSTALL =
|
||
[int]$Config.Plugins.GCP
|
||
|
||
KASTEN_INSTALL =
|
||
[int]$Config.Plugins.Kasten
|
||
|
||
}
|
||
Import-Configuration `
|
||
"C:\Scripte\VeeamConfig.json"
|
||
|
||
Initialize-Configuration |